Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 45 additions & 83 deletions src/AutoGrid.Tests/AutoGrid.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,84 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3DF2A55-FF73-4BC5-B1F4-2B71B3BC523A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoGrid.Tests</RootNamespace>
<AssemblyName>SpicyTaco.AutoGrid.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions">
<HintPath>..\packages\FluentAssertions.3.1.229\lib\net40\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core">
<HintPath>..\packages\FluentAssertions.3.1.229\lib\net40\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.2.1507.118, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="describe_auto_grid.cs" />
<Compile Include="describe_stack_panel.cs" />
<Compile Include="FluentAssertionExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AutoGrid\AutoGrid.csproj">
<Project>{60440edd-cc03-479d-aa9d-7c6e53a57630}</Project>
<Name>AutoGrid</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net40;net5.0-windows7.0;net6.0-windows7.0;net7.0-windows7.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<UseWPF>true</UseWPF>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PathMap>$(MSBuildProjectDirectory)=$(MSBuildProjectName)</PathMap>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net40'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.3" />
<PackageReference Include="FluentAssertions" Version="3.1.229" />
<PackageReference Include="Moq" Version="4.2.1507.118" />
<PackageReference Include="xunit" Version="1.9.2" />
<PackageReference Include="xunit.extensions" Version="1.9.2" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) != 'net40'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.5.0" />
<!--<PackageReference Include="xunit.extensions" Version="2.0.0" />-->
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AutoGrid\AutoGrid.csproj" />
</ItemGroup>

</Project>
20 changes: 19 additions & 1 deletion src/AutoGrid.Tests/FluentAssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using FluentAssertions;
using FluentAssertions.Execution;
using FluentAssertions.Primitives;
using Xunit;
using Xunit.Extensions;

namespace AutoGrid.Tests
{
Expand All @@ -11,11 +13,16 @@ public static class FluentAssertionExtensions
// ReSharper disable once InconsistentNaming
public class UIElementAssertions : ReferenceTypeAssertions<UIElement, UIElementAssertions>
{
#if NET5_0_OR_GREATER
public UIElementAssertions(UIElement value) : base(value)
{
}
#else
public UIElementAssertions(UIElement value)
{
Subject = value;
}

#endif
public AndConstraint<UIElementAssertions> BeAtGridPosition(
int expectedRow, int expectedColumn, string because = "", params object[] becauseArgs)
{
Expand All @@ -30,12 +37,23 @@ public AndConstraint<UIElementAssertions> BeAtGridPosition(
return new AndConstraint<UIElementAssertions>(this);
}


#if NET5_0_OR_GREATER
protected override string Identifier => "FrameworkElement";
#else
protected override string Context => "FrameworkElement";
#endif
}

public static UIElementAssertions Should(this UIElement subject)
{
return new UIElementAssertions(subject);
}
#if NET5_0_OR_GREATER
public static AndConstraint<ObjectAssertions> ShouldBeEquivalentTo<T>(this T t, T value)
{
return t.Should().BeEquivalentTo(t);
}
#endif
}
}
14 changes: 14 additions & 0 deletions src/AutoGrid.Tests/MyTestFactAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Xunit;

namespace AutoGrid.Tests
{
public class MyTestFactAttribute :
#if NET5_0_OR_GREATER
WpfFactAttribute
#else
FactAttribute
#endif
{

}
}
15 changes: 15 additions & 0 deletions src/AutoGrid.Tests/MyTestTheoryAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Xunit;
using Xunit.Extensions;

namespace AutoGrid.Tests
{
public class MyTestTheoryAttribute :
#if NET5_0_OR_GREATER
WpfTheoryAttribute
#else
TheoryAttribute
#endif
{

}
}
Loading