Merge pull request #98 from wieslawsoltes/TestsFix

@wieslawsoltes:   Migrated to XUnit and fixed tests
This commit is contained in:
José Manuel Nieto 2016-02-21 18:06:21 +01:00
Родитель 55433b0d6d 6686ad4b8d
Коммит e7e851f8e5
37 изменённых файлов: 647 добавлений и 625 удалений

Просмотреть файл

@ -1,30 +1,28 @@
namespace Glass.Tests
{
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
[TestClass]
public class AutoKeyDictionaryTests
{
[TestMethod]
[Fact]
public void IndexerTestKeyExist()
{
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
var value = "Pepito";
sut.Add(2, value);
var result = sut[1];
Assert.AreEqual(value, result);
Assert.Equal(value, result);
}
[TestMethod]
[ExpectedException(typeof(KeyNotFoundException))]
[Fact]
public void IndexerTestKeyDoesNotExist()
{
var sut = new AutoKeyDictionary<int?, string>(i => i + 1, i => i < 2);
var result = sut[1];
Assert.Throws<KeyNotFoundException>(() => sut[1]);
}
[TestMethod]
[Fact]
public void TryGetTestKeyExist()
{
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
@ -32,7 +30,7 @@
sut.Add(2, expected);
string actual;
var result = sut.TryGetValue(1, out actual);
Assert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
}
}

Просмотреть файл

@ -2,12 +2,11 @@
{
using System;
using Glass.ChangeTracking;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
[TestClass]
public class ObservablePropertyChainTests
{
[TestMethod]
[Fact]
public void SubscriptionToOneLevelPath()
{
var changeSource = new DummyViewModel();
@ -17,10 +16,10 @@
sut.Subscribe(o => actualText = o);
changeSource.Text = "Hello world";
Assert.AreEqual("Hello world", actualText);
Assert.Equal("Hello world", actualText);
}
[TestMethod]
[Fact]
public void SubscriptionToTwoLevelPath()
{
var changeSource = new DummyViewModel { Child = new DummyViewModel() };
@ -30,10 +29,10 @@
sut.Subscribe(o => actualText = o);
changeSource.Child.Text = "Hello world";
Assert.AreEqual("Hello world", actualText);
Assert.Equal("Hello world", actualText);
}
[TestMethod]
[Fact]
public void GivenSubscriptionToTwoLevelPath_WhenRootChanges_NotificationsShouldArrive()
{
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
@ -43,10 +42,10 @@
sut.Subscribe(o => actualText = o);
changeSource.Child = new DummyViewModel { Text = "This is the real thing" };
Assert.AreEqual("This is the real thing", actualText);
Assert.Equal("This is the real thing", actualText);
}
[TestMethod]
[Fact]
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesButValuesAreSame_NoNotificationAreReceived()
{
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Same" } };
@ -56,10 +55,10 @@
sut.Subscribe(o => hit = true);
changeSource.Child = new DummyViewModel { Text = "Same" };
Assert.IsFalse(hit);
Assert.False(hit);
}
[TestMethod]
[Fact]
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesInDifferentSteps_NotificationsShouldArrive()
{
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
@ -70,34 +69,34 @@
changeSource.Child = new DummyViewModel();
changeSource.Child.Text = "This is the real thing";
Assert.AreEqual("This is the real thing", actualText);
Assert.Equal("This is the real thing", actualText);
}
[TestMethod]
[Fact]
public void GivenSubscriptionToTwoLevelPathToStruct_RetrievesTheCorrectValue()
{
var changeSource = new DummyViewModel { Child = new DummyViewModel { MyStruct = new MyStruct { Text = "My text" } } };
var sut = new ObservablePropertyChain(changeSource, "Child.MyStruct.Text");
Assert.AreEqual("My text", sut.Value);
Assert.Equal("My text", sut.Value);
}
[TestMethod]
[Fact]
public void ValueTypeChain_WithOneLevel_ValueIsAccessed()
{
var root = new MyStruct { Text = "Hello" };
var sut = new ValueTypePropertyChain(root, "Text");
Assert.AreEqual("Hello", sut.Value);
Assert.Equal("Hello", sut.Value);
}
[TestMethod]
[Fact]
public void ValueTypeChain_WithTwoLevels_ValueIsAccessed()
{
var root = new MyStruct { Child = new ChildStruct { Text = "Some text" } };
var sut = new ValueTypePropertyChain(root, "Child.Text");
Assert.AreEqual("Some text", sut.Value);
Assert.Equal("Some text", sut.Value);
}
}
}

Просмотреть файл

@ -4,12 +4,11 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
[TestClass]
public class DependencyResolverTest
{
[TestMethod]
[Fact]
public void SortTest()
{
var a = new Node("A");
@ -25,10 +24,10 @@
var expected = new List<Node> { d, e, c, b, a };
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void SimpleTest()
{
var prop = new Node("Property");
@ -39,10 +38,10 @@
var expected = new List<Node> { prop, val };
var actual = DependencySorter.SortDependencies(new Collection<Node> { prop, val }).ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void AlreadySorted()
{
var a = new Node("A");
@ -60,10 +59,10 @@
var expected = new List<Node> { a, b, c, d, e };
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void PartiallySorted()
{
var a = new Node("A");
@ -81,11 +80,10 @@
var expected = new List<Node> { a, b, c, e, d };
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[Fact]
public void CircularDependency()
{
var a = new Node("A");
@ -99,7 +97,7 @@
c.Dependencies = new Collection<Node> { d, e };
e.Dependencies = new Collection<Node> { a };
DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e });
Assert.Throws<InvalidOperationException>(() => DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }));
}
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -8,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Glass.Tests</RootNamespace>
<AssemblyName>Glass.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@ -18,6 +19,7 @@
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -50,6 +52,22 @@
<HintPath>..\..\..\packages\Rx-Linq.2.3.0-beta2\lib\net45\System.Reactive.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -57,11 +75,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="ChangeTracking\DummyViewModel.cs" />
@ -104,6 +118,12 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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">

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -16,4 +16,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

Просмотреть файл

@ -3,4 +3,11 @@
<package id="Rx-Core" version="2.3.0-beta2" targetFramework="net452" />
<package id="Rx-Interfaces" version="2.3.0-beta2" targetFramework="net452" />
<package id="Rx-Linq" version="2.3.0-beta2" targetFramework="net452" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,7 +1,7 @@
namespace OmniXaml.Services.DotNetFx.Tests
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Tests.Classes;
using OmniXaml.Tests.Classes.WpfLikeModel;
using OmniXaml.Tests.Common.DotNetFx;
@ -9,19 +9,16 @@
using Services.DotNetFx;
using Services.Tests;
[TestClass]
[Ignore]
public class InflatableFactoryTest
{
[TestMethod]
[Fact(Skip = "Ignore")]
public void Window()
{
var sut = CreateSut();
var myWindow = sut.Create<MyWindow>();
Assert.IsInstanceOfType(myWindow, typeof (MyWindow));
Assert.AreEqual(myWindow.Title, "Hello World :)");
Assert.IsType(typeof (MyWindow), myWindow);
Assert.Equal(myWindow.Title, "Hello World :)");
}
private static AutoInflatingTypeFactory CreateSut()
@ -34,30 +31,30 @@
return inflatableTypeFactory;
}
[TestMethod]
[Fact(Skip = "Ignore")]
public void UserControl()
{
var sut = CreateSut();
var myWindow = sut.Create<WindowWithUserControl>();
Assert.IsInstanceOfType(myWindow, typeof (WindowWithUserControl));
Assert.AreEqual(myWindow.Title, "Hello World :)");
Assert.IsInstanceOfType(myWindow.Content, typeof (UserControl));
Assert.AreEqual("It's-a me, Mario", ((UserControl) myWindow.Content).Property);
Assert.IsType(typeof (WindowWithUserControl), myWindow);
Assert.Equal(myWindow.Title, "Hello World :)");
Assert.IsType(typeof (UserControl), myWindow.Content);
Assert.Equal("It's-a me, Mario", ((UserControl) myWindow.Content).Property);
}
[TestMethod]
[Fact(Skip = "Ignore")]
public void UserControlLoadingWithUri()
{
var sut = CreateSut();
var myWindow = (Window) sut.Create(new Uri("WpfLikeModel/WindowWithUserControl.xaml", UriKind.Relative));
Assert.IsInstanceOfType(myWindow, typeof (WindowWithUserControl));
Assert.AreEqual(myWindow.Title, "Hello World :)");
Assert.IsInstanceOfType(myWindow.Content, typeof (UserControl));
Assert.IsType(typeof (WindowWithUserControl), myWindow);
Assert.Equal(myWindow.Title, "Hello World :)");
Assert.IsType(typeof (UserControl), myWindow.Content);
var userControl = (UserControl) myWindow.Content;
Assert.AreEqual("It's-a me, Mario", userControl.Property);
Assert.IsInstanceOfType(userControl.Content, typeof (ChildClass));
Assert.Equal("It's-a me, Mario", userControl.Property);
Assert.IsType(typeof (ChildClass), userControl.Content);
}
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -38,6 +39,22 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -45,11 +62,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="InflatableFactoryTest.cs" />
@ -94,7 +107,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
@ -116,6 +129,12 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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">

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="xunit.core" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.3239" newVersion="2.2.0.3239" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,16 +1,15 @@
namespace OmniXaml.Services.Tests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OmniXaml.Tests.Classes.WpfLikeModel;
using Xunit;
[TestClass]
public class InflatableTests : GivenAnInflatableTypeLoader
{
[TestMethod]
[Fact(Skip = "Ignore")]
public void InflatableInDataTemplateTest()
{
var actualInstance = TypeFactory.Create<WindowWithTemplateAndUserControl>();
Assert.IsInstanceOfType(actualInstance, typeof(WindowWithTemplateAndUserControl));
Assert.IsType(typeof(WindowWithTemplateAndUserControl), actualInstance);
}
}
}

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -43,16 +43,16 @@
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.2.0-beta1-build3239\lib\dotnet\xunit.assert.dll</HintPath>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.2.0-beta1-build3239\lib\dotnet\xunit.core.dll</HintPath>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.2.0-beta1-build3239\lib\net45\xunit.execution.desktop.dll</HintPath>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
@ -62,13 +62,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="ObjectAssemblerAdvancedNamescopeTests.cs" />
@ -136,7 +130,7 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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.

Просмотреть файл

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.2.0-beta1-build1144" targetFramework="net45" developmentDependency="true" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -2,12 +2,11 @@
{
using System.Reflection;
using Builder;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
[TestClass]
public class ConfiguredAssemblyWithNamespacesTests
{
[TestMethod]
[Fact]
public void LooksInCorrectNamespace()
{
var expectedType = typeof(OmniXaml.Tests.Classes.Another.DummyChild);
@ -17,7 +16,7 @@
var result = can.Get("DummyChild");
Assert.AreEqual(expectedType, result);
Assert.Equal(expectedType, result);
}
}
}

Просмотреть файл

@ -5,10 +5,9 @@
using System.Linq;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Resources;
[TestClass]
public class InstructionTreeBuilderTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly InstructionResources source;
@ -18,7 +17,7 @@
source = new InstructionResources(this);
}
[TestMethod]
[Fact]
public void InstructionToNodeConversionWithLeadingAndTrailing()
{
var input = new List<Instruction>
@ -38,10 +37,10 @@
}
};
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void InstructionToNodeConversionWithLeadingBodyAndTrailing()
{
var input = new List<Instruction>
@ -73,10 +72,10 @@
}
};
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void TestReverseMembers()
{
var input = source.TestReverseMembers;
@ -90,10 +89,10 @@
var actualNodes = h.Children.SelectMany(node => node.Dump());
var expectedInstructions = source.TestReverseMembersReverted;
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void TestReverseMembersWithCollection()
{
var input = source.TestReverseMembers;
@ -107,10 +106,10 @@
var actualNodes = h.Children.SelectMany(node => node.Dump());
var expectedInstructions = source.TestReverseMembersReverted;
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void DependencySorting()
{
var input = source.TwoMembers;
@ -124,11 +123,11 @@
var actualNodes = h.Children.SelectMany(node => node.Dump());
var expectedInstructions = source.TwoMembersReversed;
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void GivenCollectionAndSimpleMember_AfterCreatingHierarchy_DumpReturnsTheOriginalInput()
{
var sut = new InstructionTreeBuilder();
@ -137,7 +136,7 @@
var nodes = instructionNodes.SelectMany(node => node.Dump()).ToList();
CollectionAssert.AreEqual(source.ComboBoxCollectionOnly.ToList(), nodes);
Assert.Equal(source.ComboBoxCollectionOnly.ToList(), nodes);
}
}
}

Просмотреть файл

@ -5,10 +5,9 @@
using Classes;
using Classes.WpfLikeModel;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Resources;
[TestClass]
public class LookaheadBufferTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly InstructionResources resources;
@ -18,7 +17,7 @@
resources = new InstructionResources(this);
}
[TestMethod]
[Fact]
public void LookAheadTest()
{
var look = new List<Instruction>
@ -36,10 +35,10 @@
var enumerator = look.GetEnumerator();
enumerator.MoveNext();
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
Assert.AreEqual(8, count);
Assert.Equal(8, count);
}
[TestMethod]
[Fact]
public void LookAheadTestStartZero()
{
var instructions = new List<Instruction>();
@ -47,10 +46,10 @@
var enumerator = instructions.GetEnumerator();
enumerator.MoveNext();
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
Assert.AreEqual(0, count);
Assert.Equal(0, count);
}
[TestMethod]
[Fact]
public void LookAheadTestStartMiniumLength()
{
var look = new List<Instruction>
@ -62,10 +61,10 @@
var enumerator = look.GetEnumerator();
enumerator.MoveNext();
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
Assert.AreEqual(2, count);
Assert.Equal(2, count);
}
[TestMethod]
[Fact]
public void LookAheadTest10()
{
var look = new List<Instruction>
@ -85,10 +84,10 @@
var enumerator = look.GetEnumerator();
enumerator.MoveNext();
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
Assert.AreEqual(10, count);
Assert.Equal(10, count);
}
[TestMethod]
[Fact]
public void LookAheadTestWithGetObjectAndCollection()
{
var look = resources.ComboBoxUnsorted;
@ -103,7 +102,7 @@
enumerator.MoveNext();
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
Assert.AreEqual(expectedCount, count);
Assert.Equal(expectedCount, count);
}
}
}

Просмотреть файл

@ -4,10 +4,9 @@
using System.Collections.Generic;
using System.Linq;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Resources;
[TestClass]
public class MemberDependencyNodeSorterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly MemberDependencyNodeSorter memberDependencyNodeSorter = new MemberDependencyNodeSorter();
@ -18,7 +17,7 @@
resources = new InstructionResources(this);
}
[TestMethod]
[Fact]
public void SortWholeStyle()
{
var input = resources.StyleUnsorted;
@ -27,11 +26,11 @@
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
var expectedInstructions = resources.StyleSorted;
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void SortSetter()
{
var input = resources.SetterUnsorted;
@ -40,10 +39,10 @@
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
var expectedInstructions = resources.SetterSorted;
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void SortComboBox()
{
var input = resources.ComboBoxUnsorted;
@ -52,10 +51,10 @@
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
var expectedInstructions = resources.ComboBoxSorted;
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void SortTwoComboBoxes()
{
var input = resources.TwoComboBoxesUnsorted;
@ -64,10 +63,10 @@
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
var expectedInstructions = resources.TwoComboBoxesSorted;
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void SortMarkupExtension()
{
var input = resources.ListBoxSortedWithExtension;
@ -76,7 +75,7 @@
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
var expectedInstructions = resources.ListBoxSortedWithExtension;
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
}

Просмотреть файл

@ -6,18 +6,16 @@
using System.Reflection;
using Builder;
using Classes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Typing;
[TestClass]
public class NamespaceRegistryTests
{
private NamespaceRegistry registry;
private Type type;
private string clrNamespace;
[TestInitialize]
public void Initialize()
public NamespaceRegistryTests()
{
type = typeof(DummyClass);
registry = new NamespaceRegistry();
@ -29,40 +27,40 @@
.With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) }));
}
[TestMethod]
[Fact]
public void RegisterPrefixTest()
{
CollectionAssert.AreEqual(
Assert.Equal(
registry.RegisteredPrefixes.ToList(),
new Collection<PrefixRegistration> {new PrefixRegistration("my", "target"), new PrefixRegistration("clr", clrNamespace)});
}
[TestMethod]
[Fact]
public void GetClrNsByPrefix()
{
var clrNs = registry.GetClrNamespaceByPrefix("clr");
var expected = new ClrNamespace(type.GetTypeInfo().Assembly, type.Namespace);
Assert.AreEqual(expected, clrNs);
Assert.Equal(expected, clrNs);
}
[TestMethod]
[Fact]
public void GetXamlNamespaceOfNotRegisteredPrefix()
{
Assert.IsNull(registry.GetXamlNamespace("unknown_namespace"));
Assert.Null(registry.GetXamlNamespace("unknown_namespace"));
}
[TestMethod]
[Fact]
public void GetNamespaceByPrefix()
{
var ns = registry.GetXamlNamespaceByPrefix("my");
Assert.AreEqual("target", ns.Name);
Assert.Equal("target", ns.Name);
}
[TestMethod]
[Fact]
public void GetNamespace()
{
var ns = registry.GetXamlNamespace("target");
Assert.AreEqual("target", ns.Name);
Assert.Equal("target", ns.Name);
}
}
}

Просмотреть файл

@ -5,14 +5,11 @@
using Classes;
using Classes.WpfLikeModel;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using ObjectAssembler;
using Resources;
using TypeConversion;
using Xunit;
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
[TestClass]
public class ObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private InstructionResources source;
@ -21,11 +18,6 @@
public ObjectAssemblerTests()
{
source = new InstructionResources(this);
}
[TestInitialize]
public void Initialize()
{
sut = CreateSut();
}
@ -47,17 +39,17 @@
return assembler;
}
[TestMethod]
[Fact]
public void OneObject()
{
sut.Process(source.OneObject);
var result = sut.Result;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.IsType(typeof(DummyClass), result);
}
[TestMethod]
[Fact]
public void ObjectWithMember()
{
sut.Process(source.ObjectWithMember);
@ -65,8 +57,8 @@
var result = sut.Result;
var property = ((DummyClass)result).SampleProperty;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual("Property!", property);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal("Property!", property);
}
[Fact]
@ -78,8 +70,8 @@
var result = sut.Result;
var property = ((DummyClass)result).EnumProperty;
Xunit.Assert.IsType<DummyClass>(result);
Xunit.Assert.Equal(SomeEnum.One, property);
Assert.IsType<DummyClass>(result);
Assert.Equal(SomeEnum.One, property);
}
[Fact]
@ -91,11 +83,11 @@
var result = sut.Result;
var property = ((DummyClass)result).EnumProperty;
Xunit.Assert.IsType<DummyClass>(result);
Xunit.Assert.Equal(SomeEnum.One, property);
Assert.IsType<DummyClass>(result);
Assert.Equal(SomeEnum.One, property);
}
[TestMethod]
[Fact]
public void ObjectWithTwoMembers()
{
sut.Process(source.ObjectWithTwoMembers);
@ -104,12 +96,12 @@
var property1 = ((DummyClass)result).SampleProperty;
var property2 = ((DummyClass)result).AnotherProperty;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual("Property!", property1);
Assert.AreEqual("Another!", property2);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal("Property!", property1);
Assert.Equal("Another!", property2);
}
[TestMethod]
[Fact]
public void ObjectWithChild()
{
sut.Process(source.ObjectWithChild);
@ -117,11 +109,11 @@
var result = sut.Result;
var property = ((DummyClass)result).Child;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.IsInstanceOfType(property, typeof(ChildClass));
Assert.IsType(typeof(DummyClass), result);
Assert.IsType(typeof(ChildClass), property);
}
[TestMethod]
[Fact]
public void WithCollection()
{
sut.Process(source.CollectionWithMoreThanOneItem);
@ -129,12 +121,12 @@
var result = sut.Result;
var children = ((DummyClass)result).Items;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual(3, children.Count);
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
Assert.IsType(typeof(DummyClass), result);
Assert.Equal(3, children.Count);
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
}
[TestMethod]
[Fact]
public void CollectionWithInnerCollection()
{
sut.Process(source.CollectionWithInnerCollection);
@ -142,15 +134,15 @@
var result = sut.Result;
var children = ((DummyClass)result).Items;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual(3, children.Count);
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
Assert.IsType(typeof(DummyClass), result);
Assert.Equal(3, children.Count);
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
var innerCollection = children[0].Children;
Assert.AreEqual(2, innerCollection.Count);
CollectionAssert.AllItemsAreInstancesOfType(innerCollection, typeof(Item));
Assert.Equal(2, innerCollection.Count);
Assert.All(innerCollection, (child) => Assert.IsType(typeof(Item), child));
}
[TestMethod]
[Fact]
public void WithCollectionAndInnerAttribute()
{
sut.Process(source.WithCollectionAndInnerAttribute);
@ -160,12 +152,12 @@
var firstChild = children.First();
var property = firstChild.Title;
Assert.IsInstanceOfType(result, typeof(DummyClass));
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
Assert.AreEqual("SomeText", property);
Assert.IsType(typeof(DummyClass), result);
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
Assert.Equal("SomeText", property);
}
[TestMethod]
[Fact]
public void MemberWithIncompatibleTypes()
{
sut.Process(source.MemberWithIncompatibleTypes);
@ -173,11 +165,11 @@
var result = sut.Result;
var property = ((DummyClass)result).Number;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual(12, property);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal(12, property);
}
[TestMethod]
[Fact]
public void ExtensionWithArgument()
{
sut.Process(source.ExtensionWithArgument);
@ -185,11 +177,11 @@
var result = sut.Result;
var property = ((DummyClass)result).SampleProperty;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual("Option", property);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal("Option", property);
}
[TestMethod]
[Fact]
public void ExtensionWithTwoArguments()
{
sut.Process(source.ExtensionWithTwoArguments);
@ -197,11 +189,11 @@
var result = sut.Result;
var property = ((DummyClass)result).SampleProperty;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual("OneSecond", property);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal("OneSecond", property);
}
[TestMethod]
[Fact]
public void ExtensionThatReturnsNull()
{
sut.Process(source.ExtensionThatReturnsNull);
@ -209,11 +201,11 @@
var result = sut.Result;
var property = ((DummyClass)result).SampleProperty;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.IsNull(property);
Assert.IsType(typeof(DummyClass), result);
Assert.Null(property);
}
[TestMethod]
[Fact]
public void ExtensionWithNonStringArgument()
{
sut.Process(source.ExtensionWithNonStringArgument);
@ -221,22 +213,22 @@
var result = sut.Result;
var property = ((DummyClass)result).Number;
Assert.IsInstanceOfType(result, typeof(DummyClass));
Assert.AreEqual(123, property);
Assert.IsType(typeof(DummyClass), result);
Assert.Equal(123, property);
}
[TestMethod]
[Fact]
public void KeyDirective()
{
sut.Process(source.KeyDirective);
var actual = sut.Result;
Assert.IsInstanceOfType(actual, typeof(DummyClass));
Assert.IsType(typeof(DummyClass), actual);
var dictionary = (IDictionary)((DummyClass)actual).Resources;
Assert.IsTrue(dictionary.Count > 0);
Assert.True(dictionary.Count > 0);
}
[TestMethod]
[Fact]
public void String()
{
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
@ -244,12 +236,12 @@
sut.Process(source.GetString(sysNs));
var actual = sut.Result;
Assert.IsInstanceOfType(actual, typeof(string));
Assert.AreEqual("Text", actual);
Assert.IsType(typeof(string), actual);
Assert.Equal("Text", actual);
}
[TestMethod]
[Fact]
public void TopDownContainsOuterObject()
{
sut.Process(source.InstanceWithChild);
@ -257,51 +249,49 @@
var dummyClassXamlType = RuntimeTypeSource.GetByType(typeof(DummyClass));
var lastInstance = sut.TopDownValueContext.GetLastInstance(dummyClassXamlType);
Assert.IsInstanceOfType(lastInstance, typeof(DummyClass));
Assert.IsType(typeof(DummyClass), lastInstance);
}
[TestMethod]
[ExpectedException(typeof(ParseException))]
[Fact]
public void AttemptToAssignItemsToNonCollectionMember()
{
sut.Process(source.AttemptToAssignItemsToNonCollectionMember);
Assert.Throws<ParseException>(() => sut.Process(source.AttemptToAssignItemsToNonCollectionMember));
}
[TestMethod]
[ExpectedException(typeof(ParseException))]
[Fact]
public void TwoChildrenWithNoRoot_ShouldThrow()
{
sut.Process(source.TwoRoots);
Assert.Throws<ParseException>(() => sut.Process(source.TwoRoots));
}
[TestMethod]
[Fact]
public void PropertyShouldBeAssignedBeforeChildIsAssociatedToItsParent()
{
sut.Process(source.ParentShouldReceiveInitializedChild);
var parent = (SpyingParent)sut.Result;
Assert.IsTrue(parent.ChildHadNamePriorToBeingAssigned);
Assert.True(parent.ChildHadNamePriorToBeingAssigned);
}
[TestMethod]
[Fact]
public void MixedCollection()
{
sut.Process(source.MixedCollection);
var result = sut.Result;
Assert.IsInstanceOfType(result, typeof(ArrayList));
Assert.IsType(typeof(ArrayList), result);
var arrayList = (ArrayList)result;
Assert.IsTrue(arrayList.Count > 0);
Assert.True(arrayList.Count > 0);
}
[TestMethod]
[Fact]
public void MixedCollectionWithRootInstance()
{
var root = new ArrayList();
var assembler = CreateSutForLoadingSpecificInstance(root);
assembler.Process(source.MixedCollection);
var result = assembler.Result;
Assert.IsInstanceOfType(result, typeof(ArrayList));
Assert.IsType(typeof(ArrayList), result);
var arrayList = (ArrayList)result;
Assert.IsTrue(arrayList.Count > 0);
Assert.True(arrayList.Count > 0);
}
[Fact]
@ -312,7 +302,7 @@
sut.Process(source.RootInstanceWithAttachableMember);
var result = sut.Result;
var attachedProperty = Container.GetProperty(result);
Xunit.Assert.Equal("Value", attachedProperty);
Assert.Equal("Value", attachedProperty);
}
[Fact]
@ -325,8 +315,8 @@
var firstChild = items.First();
var attachedProperty = Container.GetProperty(firstChild);
Xunit.Assert.Equal(2, items.Count);
Xunit.Assert.Equal("Value", attachedProperty);
Assert.Equal(2, items.Count);
Assert.Equal("Value", attachedProperty);
}
[Fact]
@ -337,7 +327,7 @@
var instance = sut.Result;
var col = Container.GetCollection(instance);
Xunit.Assert.NotEmpty(col);
Assert.NotEmpty(col);
}
[Fact]
@ -345,7 +335,7 @@
{
var sut = CreateSut();
sut.Process(source.CustomCollection);
Xunit.Assert.NotEmpty((IEnumerable)sut.Result);
Assert.NotEmpty((IEnumerable)sut.Result);
}
[Fact]
@ -354,7 +344,7 @@
var sut = CreateSut();
sut.Process(source.PureCollection);
var actual = (ArrayList)sut.Result;
Xunit.Assert.NotEmpty(actual);
Assert.NotEmpty(actual);
}
[Fact]
@ -366,7 +356,7 @@
var customCollection = actual.Collection;
Xunit.Assert.NotEmpty(customCollection);
Assert.NotEmpty(customCollection);
}
[Fact]
@ -378,7 +368,7 @@
var customCollection = actual.Collection;
Xunit.Assert.NotEmpty(customCollection);
Assert.NotEmpty(customCollection);
}
[Fact]
@ -388,7 +378,7 @@
sut.Process(source.ImplicitCollection);
var actual = (RootObject)sut.Result;
Xunit.Assert.False(actual.CollectionWasReplaced);
Assert.False(actual.CollectionWasReplaced);
}
[Fact]
@ -398,20 +388,20 @@
sut.Process(source.ExplicitCollection);
var actual = (RootObject)sut.Result;
Xunit.Assert.True(actual.CollectionWasReplaced);
Assert.True(actual.CollectionWasReplaced);
}
[TestMethod]
[Fact]
public void NamedObject_HasCorrectName()
{
sut.Process(source.NamedObject);
var result = sut.Result;
var tb = (TextBlock)result;
Assert.AreEqual("MyTextBlock", tb.Name);
Assert.Equal("MyTextBlock", tb.Name);
}
[TestMethod]
[Fact]
public void TwoNestedNamedObjects_HaveCorrectNames()
{
sut.Process(source.TwoNestedNamedObjects);
@ -419,11 +409,11 @@
var lbi = (ListBoxItem)result;
var textBlock = (TextBlock)lbi.Content;
Assert.AreEqual("MyListBoxItem", lbi.Name);
Assert.AreEqual("MyTextBlock", textBlock.Name);
Assert.Equal("MyListBoxItem", lbi.Name);
Assert.Equal("MyTextBlock", textBlock.Name);
}
[TestMethod]
[Fact]
public void ListBoxWithItemAndTextBlockNoNames()
{
sut.Process(source.ListBoxWithItemAndTextBlockNoNames);
@ -433,10 +423,10 @@
var lvi = (ListBoxItem)lb.Items.First();
var tb = lvi.Content;
Assert.IsInstanceOfType(tb, typeof(TextBlock));
Assert.IsType(typeof(TextBlock), tb);
}
[TestMethod]
[Fact]
public void ListBoxWithItemAndTextBlockWithNames_HaveCorrectNames()
{
sut.Process(source.ListBoxWithItemAndTextBlockWithNames);
@ -446,28 +436,28 @@
var lvi = (ListBoxItem)lb.Items.First();
var tb = (TextBlock)lvi.Content;
Assert.AreEqual("MyListBox", lb.Name);
Assert.AreEqual("MyListBoxItem", lvi.Name);
Assert.AreEqual("MyTextBlock", tb.Name);
Assert.Equal("MyListBox", lb.Name);
Assert.Equal("MyListBoxItem", lvi.Name);
Assert.Equal("MyTextBlock", tb.Name);
}
[TestMethod]
[Fact]
public void DirectContentForOneToMany()
{
sut.Process(source.DirectContentForOneToMany);
}
[TestMethod]
[Fact]
public void CorrectInstanceSetupSequence()
{
var expectedSequence = new[] { SetupSequence.Begin, SetupSequence.AfterSetProperties, SetupSequence.AfterAssociatedToParent, SetupSequence.End };
sut.Process(source.InstanceWithChild);
var listener = (TestListener)sut.LifecycleListener;
CollectionAssert.AreEqual(expectedSequence, listener.InvocationOrder);
Assert.Equal(expectedSequence.ToList().AsReadOnly(), listener.InvocationOrder);
}
[TestMethod]
[Fact]
public void MemberAfterInitalizationValue()
{
sut.Process(source.MemberAfterInitalizationValue);
@ -476,8 +466,8 @@
var str = root.Collection[0];
var dummy = (DummyClass)root.Collection[1];
Assert.AreEqual("foo", str);
Assert.AreEqual(123, dummy.Number);
Assert.Equal("foo", str);
Assert.Equal(123, dummy.Number);
}
}
}

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -54,16 +54,16 @@
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.2.0-beta1-build3239\lib\dotnet\xunit.assert.dll</HintPath>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.2.0-beta1-build3239\lib\dotnet\xunit.core.dll</HintPath>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.2.0-beta1-build3239\lib\net45\xunit.execution.desktop.dll</HintPath>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
@ -73,13 +73,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="ConfiguredAssemblyWithNamespacesTests.cs" />
@ -175,7 +169,7 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.2.0-beta1-build1144\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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.

Просмотреть файл

@ -4,10 +4,9 @@
using System.Linq;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Parsers.Parser;
[TestClass]
public class MarkupExtensionsParsingFromProtoToXaml : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly IInstructionParser sut;
@ -17,7 +16,7 @@
sut = new InstructionParser(RuntimeTypeSource);
}
[TestMethod]
[Fact]
public void SimpleExtension()
{
var input = new List<ProtoInstruction>
@ -40,10 +39,10 @@
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void ExtensionWithOption()
{
var input = new List<ProtoInstruction>
@ -69,7 +68,7 @@
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
}
}

Просмотреть файл

@ -5,12 +5,10 @@
using System.Reflection;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Parsers.Parser;
using Resources;
using Xunit;
[TestClass]
public class ParsingTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly IInstructionParser sut;
@ -29,7 +27,7 @@
return new InstructionParser(RuntimeTypeSource);
}
[TestMethod]
[Fact]
public void NamespaceDeclarationOnly()
{
var input = new List<ProtoInstruction>
@ -45,10 +43,10 @@
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void SingleInstanceCollapsed()
{
var input = protoResources.SingleCollapsed;
@ -57,10 +55,10 @@
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void SingleOpenAndClose()
{
var input = protoResources.SingleOpenAndClose;
@ -69,72 +67,72 @@
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void EmptyElementWithStringProperty()
{
var input = protoResources.EmptyElementWithStringProperty;
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(source.ObjectWithMember.ToList(), actualNodes.ToList());
Assert.Equal(source.ObjectWithMember.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void EmptyElementWithTwoStringProperties()
{
var input = protoResources.EmptyElementWithTwoStringProperties;
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(source.ObjectWithTwoMembers.ToList(), actualNodes.ToList());
Assert.Equal(source.ObjectWithTwoMembers.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ElementWith2NsDeclarations()
{
var input = protoResources.ElementWith2NsDeclarations2;
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(source.ElementWithTwoDeclarations.ToList(), actualNodes.ToList());
Assert.Equal(source.ElementWithTwoDeclarations.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ElementWithNestedChild()
{
var input = protoResources.ElementWithNestedChild;
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(source.NestedChild.ToList(), actualNodes.ToList());
Assert.Equal(source.NestedChild.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ComplexNesting()
{
var input = protoResources.ComplexNesting;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.ComplexNesting.ToList(), actualNodes);
Assert.Equal(source.ComplexNesting.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void ChildCollection()
{
var input = protoResources.CollectionWithMoreThanOneItem;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
Assert.Equal(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void NestedChildWithContentProperty()
{
@ -143,50 +141,50 @@
var actual = sut.Parse(input).ToList();
var expected = source.NestedChildWithContentProperty.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void NestedCollectionWithContentProperty()
{
var input = protoResources.NestedCollectionWithContentProperty;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
Assert.Equal(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void CollectionsContentPropertyNesting()
{
var input = protoResources.ContentPropertyNesting;
var actualNodes = sut.Parse(input).ToList();
var expectedInstructions = source.ContentPropertyNesting;
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes);
Assert.Equal(expectedInstructions.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void TwoNestedProperties()
{
var input = protoResources.TwoNestedProperties;
var actualNodes = sut.Parse(input).ToList();
var expectedInstructions = source.TwoNestedProperties;
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes);
Assert.Equal(expectedInstructions.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void TwoNestedPropertiesUsingContentProperty()
{
var input = protoResources.TwoNestedPropertiesUsingContentProperty;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.TwoNestedPropertiesUsingContentProperty.ToList(), actualNodes);
Assert.Equal(source.TwoNestedPropertiesUsingContentProperty.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem()
{
@ -194,46 +192,46 @@
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem.ToList(), actualNodes);
Assert.Equal(source.TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void MixedPropertiesWithContentPropertyAfter()
{
CollectionAssert.AreEqual(
Assert.Equal(
source.MixedPropertiesWithContentPropertyAfter.ToList(),
sut.Parse(protoResources.MixedPropertiesWithContentPropertyAfter).ToList());
}
[TestMethod]
[Fact]
public void CollectionWithMixedEmptyAndNotEmptyNestedElements()
{
CollectionAssert.AreEqual(
Assert.Equal(
source.CollectionWithMixedEmptyAndNotEmptyNestedElements.ToList(),
sut.Parse(protoResources.CollectionWithMixedEmptyAndNotEmptyNestedElements).ToList());
}
[TestMethod]
[Fact]
public void MixedPropertiesWithContentPropertyBefore()
{
var input = protoResources.MixedPropertiesWithContentPropertyBefore;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.MixedPropertiesWithContentPropertyBefore.ToList(), actualNodes);
Assert.Equal(source.MixedPropertiesWithContentPropertyBefore.ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void ImplicitContentPropertyWithImplicityCollection()
{
var input = protoResources.ImplicitContentPropertyWithImplicityCollection;
var actualNodes = sut.Parse(input).ToList();
CollectionAssert.AreEqual(source.CreateExpectedNodesForImplicitContentPropertyWithImplicityCollection().ToList(), actualNodes);
Assert.Equal(source.CreateExpectedNodesForImplicitContentPropertyWithImplicityCollection().ToList(), actualNodes);
}
[TestMethod]
[Fact]
public void ClrNamespace()
{
var type = typeof(DummyClass);
@ -254,10 +252,10 @@
var actualNodes = sut.Parse(input);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ExpandedStringProperty()
{
var input = protoResources.ExpandedStringProperty;
@ -267,18 +265,18 @@
var actualNodes = sut.Parse(input);
var xamlNodes = actualNodes.ToList();
CollectionAssert.AreEqual(expectedInstructions.ToList(), xamlNodes);
Assert.Equal(expectedInstructions.ToList(), xamlNodes);
}
[TestMethod]
[Fact]
public void TextInInnerContent()
{
var actual = sut.Parse(protoResources.ContentPropertyInInnerContent).ToList();
var expected = source.TextBlockWithText.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void String()
{
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
@ -289,40 +287,40 @@
var actualNodes = sut.Parse(input);
var xamlNodes = actualNodes.ToList();
CollectionAssert.AreEqual(expectedInstructions.ToList(), xamlNodes);
Assert.Equal(expectedInstructions.ToList(), xamlNodes);
}
[TestMethod]
[Fact]
public void PureCollection()
{
var actual = sut.Parse(protoResources.PureCollection).ToList();
var expected = source.PureCollection.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void MixedCollection()
{
var actual = sut.Parse(protoResources.MixedCollection).ToList();
var expected = source.MixedCollection.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void ChildInDeeperNameScopeWithNamesInTwoLevels()
{
var actual = sut.Parse(protoResources.ChildInDeeperNameScopeWithNamesInTwoLevels).ToList();
var expected = source.ListBoxWithItemAndTextBlockWithNames.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void DirectContentForOneToMany()
{
var expected = source.DirectContentForOneToMany.ToList();
var actual = sut.Parse(protoResources.DirectContentForOneToMany).ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[Fact]
@ -332,7 +330,7 @@
var expected = source.ImplicitCollection.ToList();
var actual = sut.Parse(protoResources.ImplicitCollection).ToList();
Xunit.Assert.Equal(expected, actual);
Assert.Equal(expected, actual);
}
[Fact]
@ -341,7 +339,7 @@
var sut = CreateSut();
var expected = source.ExplicitCollection.ToList();
var actual = sut.Parse(protoResources.ExplicitCollection).ToList();
Xunit.Assert.Equal(expected, actual);
Assert.Equal(expected, actual);
}
[Fact]
@ -351,7 +349,7 @@
var expected = source.AttachableMemberThatIsCollection.ToList();
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollection).ToList();
Xunit.Assert.Equal(expected, actual);
Assert.Equal(expected, actual);
}
[Fact]
@ -361,15 +359,15 @@
var expected = source.AttachableMemberThatIsCollectionImplicit.ToList();
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollectionImplicit).ToList();
Xunit.Assert.Equal(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void ExpandedAttachablePropertyAndItemBelow()
{
var actual = sut.Parse(protoResources.ExpandedAttachablePropertyAndItemBelow).ToList();
var expected = source.ExpandedAttachablePropertyAndItemBelow.ToList();
CollectionAssert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
}
}

Просмотреть файл

@ -5,13 +5,12 @@
using System.Linq;
using System.Xml;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Parsers.Parser;
using OmniXaml.Parsers.ProtoParser;
using Resources;
using Xaml.Tests.Resources;
[TestClass]
public class FromXamlToInstructions : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly InstructionResources source;
@ -21,164 +20,163 @@
source = new InstructionResources(this);
}
[TestMethod]
[ExpectedException(typeof (XmlException))]
[Fact]
public void EmptyString()
{
ExtractNodesFromPullParser(string.Empty);
Assert.Throws<XmlException>(() => ExtractNodesFromPullParser(string.Empty));
}
[TestMethod]
[Fact]
public void SingleInstance()
{
var expectedInstructions = source.SingleInstance;
var actualNodes = ExtractNodesFromPullParser(Dummy.SingleInstance);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void RootNamespace()
{
var expectedInstructions = source.SingleInstance;
var actualNodes = ExtractNodesFromPullParser(Dummy.RootNamespace);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void InstanceWithStringPropertyAndNsDeclaration()
{
var expectedInstructions = source.ObjectWithMember;
var actualNodes = ExtractNodesFromPullParser(Dummy.StringProperty);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void InstanceWithChild()
{
var expectedInstructions = source.InstanceWithChild;
var actualNodes = ExtractNodesFromPullParser(Dummy.InstanceWithChild);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void DifferentNamespaces()
{
var expectedInstructions = source.DifferentNamespaces;
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespaces);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void DifferentNamespacesAndMoreThanOneProperty()
{
var expectedInstructions = source.DifferentNamespacesAndMoreThanOneProperty;
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespacesAndMoreThanOneProperty);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ClassWithInnerCollection()
{
var expectedInstructions = source.CollectionWithOneItem;
var actualNodes = ExtractNodesFromPullParser(Dummy.ClassWithInnerCollection);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void CollectionWithMoreThanOneItem()
{
var expectedInstructions = source.CollectionWithMoreThanOneItem;
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithMoreThanOneItem);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void CollapsedTagWithProperty()
{
var expectedInstructions = source.CollapsedTagWithProperty;
var actualNodes = ExtractNodesFromPullParser(Dummy.CollapsedTagWithProperty);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void CollectionWithClosedItemAndProperty()
{
var expectedInstructions = source.CollectionWithOneItemAndAMember;
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithClosedItemAndProperty);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void SimpleExtension()
{
var expectedInstructions = source.SimpleExtension;
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtension);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void SimpleExtensionWithOneAssignment()
{
var expectedInstructions = source.SimpleExtensionWithOneAssignment;
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtensionWithOneAssignment);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ContentPropertyForCollectionOneElement()
{
var expectedInstructions = source.ContentPropertyForCollectionOneElement;
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionOneElement);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ContentPropertyForCollectionMoreThanOneElement()
{
var expectedInstructions = source.ContentPropertyForCollectionMoreThanOneElement;
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionMoreThanOneElement);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
[TestMethod]
[Fact]
public void ContentPropertyForSingleProperty()
{
var expectedInstructions = source.ContentPropertyForSingleProperty;
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForSingleMember);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
private ICollection<Instruction> ExtractNodesFromPullParser(string xml)
@ -192,14 +190,14 @@
}
}
[TestMethod]
[Fact]
public void KeyDirective()
{
var expectedInstructions = source.KeyDirective2;
var actualNodes = ExtractNodesFromPullParser(Dummy.KeyDirective);
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
}
}

Просмотреть файл

@ -5,14 +5,13 @@
using System.Linq;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Parsers.MarkupExtensions;
using Resources;
[TestClass]
public class MarkupExtensionNodeToXamlNodesConverterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
[TestMethod]
[Fact]
public void NameOnly()
{
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"));
@ -24,10 +23,10 @@
X.EndObject(),
};
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void NameAndAttribute()
{
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection {new PropertyOption("Property", new StringNode("Value"))});
@ -43,10 +42,10 @@
X.EndObject(),
};
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void NameAndTwoAttributes()
{
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
@ -69,10 +68,10 @@
X.EndObject(),
};
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void PositionalOption()
{
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
@ -91,10 +90,10 @@
X.EndObject(),
};
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
[TestMethod]
[Fact]
public void ComposedExtensionTemplateBindingWithConverter()
{
var tree = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
@ -117,7 +116,7 @@
X.EndObject(),
};
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.Equal(expectedInstructions, actualNodes);
}
}
}

Просмотреть файл

@ -2,91 +2,90 @@
{
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using OmniXaml.Parsers.MarkupExtensions;
using Resources;
using Sprache;
[TestClass]
public class ParsingTests
{
[TestMethod]
[Fact]
public void SimpleExtension()
{
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy}");
Assert.AreEqual(new MarkupExtensionNode(new IdentifierNode("DummyExtension")), actual);
Assert.Equal(new MarkupExtensionNode(new IdentifierNode("DummyExtension")), actual);
}
[TestMethod]
[Fact]
public void PrefixedExtension()
{
var actual = MarkupExtensionParser.MarkupExtension.Parse("{x:Dummy}");
Assert.AreEqual(new MarkupExtensionNode(new IdentifierNode("x", "DummyExtension")), actual);
Assert.Equal(new MarkupExtensionNode(new IdentifierNode("x", "DummyExtension")), actual);
}
[TestMethod]
[Fact]
public void ExtensionWithTwoPositionalOptions()
{
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value1,Value2}");
var options = new OptionsCollection { new PositionalOption("Value1"), new PositionalOption("Value2") };
Assert.AreEqual(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
Assert.Equal(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
}
[TestMethod]
[Fact]
public void ExtensionWithDottedPositionalOption()
{
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Direct.Value}");
var options = new OptionsCollection { new PositionalOption("Direct.Value"), };
Assert.AreEqual(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
Assert.Equal(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
}
[TestMethod]
[Fact]
public void DelimitedBy()
{
var identifier = from c in Parse.LetterOrDigit.Many() select new string(c.ToArray());
var parser = from id in identifier.DelimitedBy(Parse.Char(',').Token()) select id;
var parsed = parser.Parse("SomeValue , AnotherValue");
CollectionAssert.AreEqual(new[] { "SomeValue", "AnotherValue" }, parsed.ToList());
Assert.Equal(new[] { "SomeValue", "AnotherValue" }, parsed.ToList());
}
[TestMethod]
[Fact]
public void ExtensionWithPositionalAndAssignmentOptions()
{
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value,Property='Some Value'}");
var options = new OptionsCollection { new PositionalOption("Value"), new PropertyOption("Property", new StringNode("Some Value")) };
Assert.AreEqual(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
Assert.Equal(new MarkupExtensionNode(new IdentifierNode("DummyExtension"), options), actual);
}
[TestMethod]
[Fact]
public void AssignmentOfDirectValue()
{
var actual = MarkupExtensionParser.Assignment.Parse("Property=SomeValue");
Assert.AreEqual(new AssignmentNode("Property", new StringNode("SomeValue")), actual);
Assert.Equal(new AssignmentNode("Property", new StringNode("SomeValue")), actual);
}
[TestMethod]
[Fact]
public void AssignmentOfDottedDirectValue()
{
var actual = MarkupExtensionParser.Assignment.Parse("Property=Some.Value");
Assert.AreEqual(new AssignmentNode("Property", new StringNode("Some.Value")), actual);
Assert.Equal(new AssignmentNode("Property", new StringNode("Some.Value")), actual);
}
[TestMethod]
[Fact]
public void AssignmentOfDirectValueWithColon()
{
var actual = MarkupExtensionParser.Assignment.Parse("Property=x:SomeValue");
Assert.AreEqual(new AssignmentNode("Property", new StringNode("x:SomeValue")), actual);
Assert.Equal(new AssignmentNode("Property", new StringNode("x:SomeValue")), actual);
}
[TestMethod]
[Fact]
public void AssignmentOfQuotedValue()
{
var actual = MarkupExtensionParser.Assignment.Parse("Property='value with spaces'");
Assert.AreEqual(new AssignmentNode("Property", new StringNode("value with spaces")), actual);
Assert.Equal(new AssignmentNode("Property", new StringNode("value with spaces")), actual);
}
[TestMethod]
[Fact]
public void ParsePositionalAndPropertyOptions()
{
var actual = MarkupExtensionParser.Options.Parse("value1,Property1=Value1,Property2='Some value'");
@ -97,18 +96,18 @@
new PropertyOption("Property2", new StringNode("Some value"))
});
Assert.AreEqual(actual, expected);
Assert.Equal(actual, expected);
}
[TestMethod]
[Fact]
public void ParsePropertyWithExtension()
{
var actual = MarkupExtensionParser.Assignment.Parse("Value={Dummy}");
var markupExtensionNode = new MarkupExtensionNode(new IdentifierNode("DummyExtension"));
Assert.AreEqual(new AssignmentNode("Value", markupExtensionNode), actual);
Assert.Equal(new AssignmentNode("Value", markupExtensionNode), actual);
}
[TestMethod]
[Fact]
public void ComposedExtensionTemplateBindingWithConverter()
{
var actual =
@ -116,10 +115,10 @@
var expected = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
Assert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
[TestMethod]
[Fact]
public void ComposedExtension()
{
var actual =
@ -128,7 +127,7 @@
var expected = MarkupExtensionNodeResources.ComposedExtension();
Assert.AreEqual(expected, actual);
Assert.Equal(expected, actual);
}
}
}

Просмотреть файл

@ -17,7 +17,7 @@
{
var sut = CreateSut();
sut.Push(1);
Xunit.Assert.Equal(1, sut.Current.Value);
Assert.Equal(1, sut.Current.Value);
}
[Fact]

Просмотреть файл

@ -5,14 +5,14 @@
using Classes.Templates;
using Classes.WpfLikeModel;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using ObjectAssembler;
using TypeConversion;
using System.Collections.Generic;
[TestClass]
public class TemplateHostingObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
[TestMethod]
[Fact]
public void SimpleTest()
{
var input = new Collection<Instruction>
@ -44,14 +44,14 @@
}
var actualNodes = sut.NodeList;
var expectedInstructions = new Collection<Instruction>
var expectedInstructions = new List<Instruction>
{
X.StartObject<Grid>(),
X.EndObject(),
};
}.AsReadOnly();
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
Assert.IsNotNull(((Item) sut.Result).Template.Content);
Assert.Equal(expectedInstructions, actualNodes);
Assert.NotNull(((Item) sut.Result).Template.Content);
}
}
}

Просмотреть файл

@ -3,11 +3,10 @@
using Builder;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Moq;
using Typing;
[TestClass]
public class TypeRepositoryTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
private readonly Mock<INamespaceRegistry> nsRegistryMock;
@ -28,46 +27,41 @@
nsRegistryMock.Setup(registry => registry.GetNamespace("clr-namespace:DummyNamespace;Assembly=DummyAssembly"))
.Returns(new ClrNamespace(type.Assembly, type.Namespace));
}
[TestInitialize]
public void Initialize()
{
sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
}
[TestMethod]
[Fact]
public void GetWithFullAddressReturnsCorrectType()
{
var xamlType = sut.GetByFullAddress(new XamlTypeName("root", "DummyClass"));
Assert.AreEqual(xamlType.UnderlyingType, typeof(DummyClass));
Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
}
[TestMethod]
[Fact]
public void GetWithFullAddressOfClrNamespaceReturnsTheCorrectType()
{
var xamlType = sut.GetByFullAddress(new XamlTypeName("clr-namespace:DummyNamespace;Assembly=DummyAssembly", "DummyClass"));
Assert.AreEqual(xamlType.UnderlyingType, typeof(DummyClass));
Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
}
[TestMethod]
[Fact]
public void GetByQualifiedName_ForTypeInDefaultNamespace()
{
sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
var xamlType = sut.GetByQualifiedName("DummyClass");
Assert.AreEqual(xamlType.UnderlyingType, typeof(DummyClass));
Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
}
[TestMethod]
[ExpectedException(typeof(TypeNotFoundException))]
[Fact]
public void FullAddressOfUnknownThrowNotFound()
{
const string unreachableTypeName = "UnreachableType";
sut.GetByFullAddress(new XamlTypeName("root", unreachableTypeName));
Assert.Throws<TypeNotFoundException>(() => sut.GetByFullAddress(new XamlTypeName("root", unreachableTypeName)));
}
}
@ -78,7 +72,7 @@
return new TypeFeatureProvider(null);
}
[TestMethod]
[Fact]
public void DependsOnRegister()
{
var sut = CreateSut();
@ -87,10 +81,10 @@
TypeRepositoryMixin.RegisterMetadata(sut, expectedMetadata);
var metadata = sut.GetMetadata<DummyClass>();
Assert.AreEqual(expectedMetadata.AsNonGeneric(), metadata);
Assert.Equal(expectedMetadata.AsNonGeneric(), metadata);
}
[TestMethod]
[Fact]
public void GetMetadata()
{
var sut = CreateSut();
@ -100,10 +94,10 @@
var actual = sut.GetMetadata<DummyClass>();
Assert.AreEqual(expected.AsNonGeneric(), actual);
Assert.Equal(expected.AsNonGeneric(), actual);
}
[TestMethod]
[Fact]
public void GetMetadataOfSubClass_ReturnsPreviousParentMetadata()
{
var sut = CreateSut();
@ -112,10 +106,10 @@
sut.RegisterMetadata(expected);
var actual = sut.GetMetadata<DummyClass>();
Assert.AreEqual(expected.AsNonGeneric(), actual);
Assert.Equal(expected.AsNonGeneric(), actual);
}
[TestMethod]
[Fact]
public void GivenMetadataDefinitionsForBothClassAndSubclass_GetMetadataOfSubClass_ReturnsItsOwnMetadata()
{
var sut = CreateSut();
@ -125,10 +119,10 @@
sut.RegisterMetadata(new GenericMetadata<DummyObject>());
var actual = sut.GetMetadata<DummyClass>();
Assert.AreEqual(expected.AsNonGeneric(), actual);
Assert.Equal(expected.AsNonGeneric(), actual);
}
[TestMethod]
[Fact]
public void GivenMetadataDefinitionsForParentAndGrandParent_GetMetadataOfChild_ReturnsParentMetadata()
{
var sut = CreateSut();
@ -139,7 +133,7 @@
var actual = sut.GetMetadata<DummyChild>();
Assert.AreEqual(expected.AsNonGeneric(), actual);
Assert.Equal(expected.AsNonGeneric(), actual);
}
}
}

Просмотреть файл

@ -3,13 +3,12 @@
using System.Collections.ObjectModel;
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Visualization;
[TestClass]
public class VisualizationTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
{
[TestMethod]
[Fact]
public void ConvertToTags()
{
var col = new Collection<Instruction>()
@ -26,7 +25,7 @@
var result = NodeVisualizer.ToTags(col);
}
[TestMethod]
[Fact]
public void ConvertToNodes()
{
var col = new Collection<Instruction>()

Просмотреть файл

@ -1,68 +1,67 @@
namespace OmniXaml.Tests.XamlXmlLoaderTests
{
using Classes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using XamlResources = Xaml.Tests.Resources.Dummy;
[TestClass]
public class MarkupExtensionsTests : GivenAXmlLoader
{
[TestMethod]
[Fact]
public void SimpleExtension()
{
var actualInstance = Loader.FromString(XamlResources.SimpleExtension);
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Text From Markup Extension", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Text From Markup Extension", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void SimpleExtensionWithPropertyAssignment()
{
var actualInstance = Loader.FromString(XamlResources.SimpleExtensionWithOneAssignment);
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("SomeValue", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("SomeValue", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void ExtensionThatRetrievesInteger()
{
var actualInstance = Loader.FromString("<DummyClass xmlns=\"root\" Number=\"{Int Number=123}\"/>");
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual(123, dummyClass.Number);
Assert.NotNull(dummyClass);
Assert.Equal(123, dummyClass.Number);
}
[TestMethod]
[Fact]
public void QuotedValue()
{
var actualInstance = Loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"{Dummy Property=\'Some Value\'}\"/>");
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Some Value", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Some Value", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void TwoQuotedValues()
{
var actualInstance = Loader.FromString(XamlResources.MarkupExtensionTwoQuotedValues);
Assert.IsInstanceOfType(actualInstance, typeof(DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Some Value", dummyClass.SampleProperty);
Assert.AreEqual("Another Value", dummyClass.AnotherProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Some Value", dummyClass.SampleProperty);
Assert.Equal("Another Value", dummyClass.AnotherProperty);
}
}
}

Просмотреть файл

@ -1,13 +1,12 @@
namespace OmniXaml.Tests.XamlXmlLoaderTests
{
using Classes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Xaml.Tests.Resources;
[TestClass]
public class NameScopeTests : GivenAXmlLoader
{
[TestMethod]
[Fact]
public void RegisterOneChildInNameScope()
{
RuntimeTypeSource.ClearNamescopes();
@ -15,10 +14,10 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
var actualInstance = Loader.FromString(Dummy.ChildInNameScope);
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
Assert.IsType(typeof(ChildClass), childInScope);
}
[TestMethod]
[Fact]
public void RegisterOneChildInNameScopeWithoutDirective()
{
RuntimeTypeSource.ClearNamescopes();
@ -26,7 +25,7 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
var actualInstance = Loader.FromString(Dummy.ChildInNamescopeNoNameDirective);
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
Assert.IsType(typeof(ChildClass), childInScope);
}
}
}

Просмотреть файл

@ -6,214 +6,208 @@
using System.Linq;
using Classes;
using Classes.WpfLikeModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xaml.Tests.Resources;
using Xunit;
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
using Xaml.Tests.Resources;
[TestClass]
public class ParsingTests : GivenAXmlLoader
{
private readonly Type expectedType = typeof (DummyClass);
[TestMethod]
[ExpectedException(typeof (LoadException))]
[Fact]
public void EmptyStreamThrows()
{
Loader.FromString(Dummy.Empty);
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.Empty));
}
[TestMethod]
[ExpectedException(typeof (LoadException))]
[Fact]
public void UnknownElementThrows()
{
Loader.FromString(Dummy.UnknownType);
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.UnknownType));
}
[TestMethod]
[ExpectedException(typeof (LoadException))]
[Fact]
public void BadFormatThrowsXamlReaderException()
{
Loader.FromString(Dummy.BadFormat);
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.BadFormat));
}
[TestMethod]
[Fact]
public void NoPrefixMapsToNamespaceAndReturnsTheCorrectInstance()
{
var actual = Loader.FromString(Dummy.RootNamespace);
Assert.IsInstanceOfType(actual, expectedType);
Assert.IsType(expectedType, actual);
}
[TestMethod]
[Fact]
public void SimpleXamlWithCollapsedTagsShouldReadLikeExplicitEndingTag()
{
var actual = Loader.FromString(Dummy.CollapsedTag);
Assert.IsInstanceOfType(actual, expectedType);
Assert.IsType(expectedType, actual);
}
[TestMethod]
[Fact]
public void DifferentNamespacesShouldReturnCorrectInstances()
{
var actual = Loader.FromString(Dummy.DifferentNamespaces);
Assert.IsInstanceOfType(actual, expectedType);
Assert.IsType(expectedType, actual);
}
[TestMethod]
[Fact]
public void ReadInstanceWithChild()
{
var actualInstance = Loader.FromString(Dummy.InstanceWithChild);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof(DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Debug.Assert(dummyClass != null, "dummyClass != null");
Assert.IsInstanceOfType(dummyClass.Child, typeof (ChildClass));
Assert.IsType(typeof (ChildClass), dummyClass.Child);
}
[TestMethod]
[Fact]
public void ReadInstanceWithThreeLevelsOfNesting()
{
var root = Loader.FromString(Dummy.ThreeLevelsOfNesting);
var dummy = root as DummyClass;
Assert.IsInstanceOfType(root, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), root); // The retrieved instance should be of type DummyClass
Debug.Assert(dummy != null, "dummy != null");
var level2Instance = dummy.Child;
Assert.IsNotNull(level2Instance);
Assert.NotNull(level2Instance);
var level3Instance = level2Instance.Child;
Assert.IsNotNull(level3Instance);
Assert.NotNull(level3Instance);
}
[TestMethod]
[Fact]
public void KeyDirective()
{
var actual = Loader.FromString(Dummy.KeyDirective);
Assert.IsInstanceOfType(actual, typeof (DummyClass));
Assert.IsType(typeof (DummyClass), actual);
var dictionary = (IDictionary) ((DummyClass) actual).Resources;
Assert.IsTrue(dictionary.Count > 0);
Assert.True(dictionary.Count > 0);
}
[TestMethod]
[Fact]
public void String()
{
var actual = Loader.FromString(Dummy.String);
Assert.IsInstanceOfType(actual, typeof (string));
Assert.AreEqual("Text", actual);
Assert.IsType(typeof (string), actual);
Assert.Equal("Text", actual);
}
[TestMethod]
[Fact]
public void StringAsProperty()
{
var actual = Loader.FromString(Dummy.StringAsProperty);
Assert.IsInstanceOfType(actual, typeof (DummyClass));
Assert.AreEqual("Text", ((DummyClass) actual).SampleProperty);
Assert.IsType(typeof (DummyClass), actual);
Assert.Equal("Text", ((DummyClass) actual).SampleProperty);
}
[TestMethod]
[Fact]
public void StringWithWhitespace()
{
var actual = Loader.FromString(Dummy.StringWithWhitespace);
Assert.IsInstanceOfType(actual, typeof (string));
Assert.AreEqual("Text", actual);
Assert.IsType(typeof (string), actual);
Assert.Equal("Text", actual);
}
[TestMethod]
[Fact]
public void Int()
{
var actual = Loader.FromString(Dummy.Int);
Assert.IsInstanceOfType(actual, typeof (int));
Assert.AreEqual(123, actual);
Assert.IsType(typeof (int), actual);
Assert.Equal(123, actual);
}
[TestMethod]
[Fact]
public void StringProperty()
{
var actualInstance = Loader.FromString(Dummy.StringProperty);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Property!", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Property!", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void ExpandedStringProperty()
{
var actualInstance = Loader.FromString(Dummy.InnerContent);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Property!", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Property!", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void InnerContentIsContentProperty()
{
var actualInstance = Loader.FromString(Dummy.ContentPropertyInInnerContent);
Assert.IsInstanceOfType(actualInstance, typeof (TextBlock), $"The retrieved instance should be of type {typeof (TextBlock)}");
Assert.IsType(typeof (TextBlock), actualInstance); // $"The retrieved instance should be of type {typeof (TextBlock)}"
var dummyClass = actualInstance as TextBlock;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Hi all!!", dummyClass.Text);
Assert.NotNull(dummyClass);
Assert.Equal("Hi all!!", dummyClass.Text);
}
[TestMethod]
[Fact]
public void NonStringProperty()
{
var actualInstance = Loader.FromString(Dummy.NonStringProperty);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass, "dummyClass != null");
Assert.AreEqual(1234, dummyClass.Number);
Assert.NotNull(dummyClass); // dummyClass != null
Assert.Equal(1234, dummyClass.Number);
}
[TestMethod]
[Fact]
public void ChildCollection()
{
var actualInstance = Loader.FromString(Dummy.ChildCollection);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.IsNotNull(dummyClass.Items);
Assert.AreEqual(3, dummyClass.Items.Count);
Assert.NotNull(dummyClass);
Assert.NotNull(dummyClass.Items);
Assert.Equal(3, dummyClass.Items.Count);
}
[TestMethod]
[Fact]
public void AttachedProperty()
{
var actualInstance = Loader.FromString(Dummy.AttachedProperty);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual(Container.GetProperty(dummyClass), "Value");
Assert.NotNull(dummyClass);
Assert.Equal(Container.GetProperty(dummyClass), "Value");
}
[TestMethod]
[Fact]
public void Ignorable()
{
var actualInstance = Loader.FromString(Dummy.Ignorable);
Assert.IsInstanceOfType(actualInstance, typeof (DummyClass), "The retrieved instance should be of type DummyClass");
Assert.IsType(typeof (DummyClass), actualInstance); // The retrieved instance should be of type DummyClass
var dummyClass = actualInstance as DummyClass;
Assert.IsNotNull(dummyClass);
Assert.AreEqual("Property!", dummyClass.SampleProperty);
Assert.NotNull(dummyClass);
Assert.Equal("Property!", dummyClass.SampleProperty);
}
[TestMethod]
[Fact]
public void DirectiveInSpecialNamespaceThatIsNotX()
{
var actual = Loader.FromString(Dummy.KeyDirectiveNotInX);
Assert.IsInstanceOfType(actual, typeof(DummyClass));
Assert.IsType(typeof(DummyClass), actual);
var dictionary = (IDictionary)((DummyClass)actual).Resources;
Assert.IsTrue(dictionary.Count > 0);
Assert.True(dictionary.Count > 0);
}
[TestMethod]
[Fact]
public void ExpandedAttachablePropertyAndItemBelow()
{
var loadedObject = Loader.FromString(Dummy.ExpandedAttachablePropertyAndItemBelow);
@ -222,15 +216,15 @@
var firstChild = items.First();
var attachedProperty = Container.GetProperty(firstChild);
Xunit.Assert.Equal(2, items.Count);
Xunit.Assert.Equal("Value", attachedProperty);
Assert.Equal(2, items.Count);
Assert.Equal("Value", attachedProperty);
}
[Fact]
public void PureCollection()
{
var actualInstance = Loader.FromString(Dummy.PureCollection);
Xunit.Assert.NotEmpty((IEnumerable) actualInstance);
Assert.NotEmpty((IEnumerable) actualInstance);
}
[Fact]
@ -239,10 +233,10 @@
var instance = Loader.FromString(Dummy.AttachableMemberThatIsCollection);
var col = Container.GetCollection(instance);
Xunit.Assert.NotEmpty(col);
Assert.NotEmpty(col);
}
[TestMethod]
[Fact]
public void ChildInDeeperNameScopeWithNamesInTwoLevels_HaveCorrectNames()
{
var actual = Loader.FromString(Dummy.ChildInDeeperNameScopeWithNamesInTwoLevels);
@ -252,9 +246,9 @@
var lvi = (ListBoxItem)lb.Items.First();
var tb = (TextBlock)lvi.Content;
Assert.AreEqual("MyListBox", lb.Name);
Assert.AreEqual("MyListBoxItem", lvi.Name);
Assert.AreEqual("MyTextBlock", tb.Name);
Assert.Equal("MyListBox", lb.Name);
Assert.Equal("MyListBoxItem", lvi.Name);
Assert.Equal("MyTextBlock", tb.Name);
}
}
}

Просмотреть файл

@ -2,11 +2,11 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
{
using Classes;
using Common.DotNetFx;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
public abstract class SpecialTests : GivenARuntimeTypeSourceNetCore
{
[TestMethod]
[Fact]
public void LoadWithRootInstance()
{
var dummy = new DummyClass
@ -19,9 +19,9 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
var actual = loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);
Assert.IsInstanceOfType(actual, dummy.GetType());
Assert.AreEqual("Value", ((DummyClass)actual).SampleProperty);
Assert.AreEqual("Other value", ((DummyClass)actual).AnotherProperty);
Assert.IsType(dummy.GetType(), actual);
Assert.Equal("Value", ((DummyClass)actual).SampleProperty);
Assert.Equal("Other value", ((DummyClass)actual).AnotherProperty);
}
}
}

Просмотреть файл

@ -2,11 +2,11 @@
<packages>
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
<package id="Sprache.SuperJMN" version="2.0.0.50" targetFramework="net45" />
<package id="xunit" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.2.0-beta1-build3239" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.2.0-beta1-build1144" targetFramework="net45" developmentDependency="true" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -3,92 +3,91 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Resources = Xaml.Tests.Resources.Wpf;
[TestClass]
public class LoadingTests : GivenAXamlXmlLoader
{
[TestMethod]
[StaFact]
public void Window()
{
var windowType = typeof(Window);
var actualInstance = LoadXaml(Resources.Window);
Assert.IsInstanceOfType(actualInstance, windowType);
Assert.IsType(windowType, actualInstance);
}
[TestMethod]
[StaFact]
public void WindowWithContent()
{
var windowType = typeof(Window);
var textBlockType = typeof(TextBlock);
var actualInstance = LoadXaml(Resources.WindowWithContent);
Assert.IsInstanceOfType(actualInstance, windowType);
Assert.IsType(windowType, actualInstance);
var window = (Window)actualInstance;
Assert.IsInstanceOfType(window.Content, textBlockType);
Assert.IsType(textBlockType, window.Content);
var textBlock = (TextBlock)window.Content;
Assert.AreEqual("Saludos cordiales!", textBlock.Text);
Assert.Equal("Saludos cordiales!", textBlock.Text);
}
[TestMethod]
[StaFact]
public void DataTemplate()
{
var visualTree = LoadXaml(Resources.DataTemplate);
}
[TestMethod]
[StaFact]
public void ShowCase()
{
var visualTree = LoadXaml(Resources.ShowCase);
}
[TestMethod]
[StaFact]
public void MicroShowCase()
{
var visualTree = LoadXaml(Resources.MicroShowCase);
}
[TestMethod]
[StaFact]
public void Stage1()
{
var visualTree = LoadXaml(Resources.Stage1);
}
[StaFact]
public void Stage2()
{
var visualTree = LoadXaml(Resources.Stage2);
}
[StaFact]
public void Stage3()
{
var visualTree = LoadXaml(Resources.Stage3);
}
[TestMethod]
[StaFact]
public void ColorResource()
{
var visualTree = (Window)LoadXaml(Resources.ColorResource);
var color = (Color)visualTree.FindResource("color");
Assert.AreEqual(0xff, color.A);
Assert.AreEqual(0x80, color.R);
Assert.AreEqual(0x80, color.G);
Assert.AreEqual(0x80, color.B);
Assert.Equal(0xff, color.A);
Assert.Equal(0x80, color.R);
Assert.Equal(0x80, color.G);
Assert.Equal(0x80, color.B);
}
[TestMethod]
[StaFact]
public void SolidColorBrushResource()
{
var visualTree = (Window)LoadXaml(Resources.SolidColorBrushResource);
var brush = (SolidColorBrush)visualTree.FindResource("brush");
var color = brush.Color;
Assert.AreEqual(0xff, color.A);
Assert.AreEqual(0x80, color.R);
Assert.AreEqual(0x80, color.G);
Assert.AreEqual(0x80, color.B);
Assert.Equal(0xff, color.A);
Assert.Equal(0x80, color.R);
Assert.Equal(0x80, color.G);
Assert.Equal(0x80, color.B);
}
}
}

Просмотреть файл

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Xunit.StaFact.0.1.36-beta\build\net45\Xunit.StaFact.props" Condition="Exists('..\..\..\packages\Xunit.StaFact.0.1.36-beta\build\net45\Xunit.StaFact.props')" />
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -43,6 +45,26 @@
<Reference Include="System" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xunit.StaFact, Version=0.1.0.0, Culture=neutral, PublicKeyToken=593f35978b459a4b, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Xunit.StaFact.0.1.36-beta\lib\net45\Xunit.StaFact.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -50,11 +72,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="GivenAXamlXmlLoader.cs" />
@ -66,6 +84,7 @@
<None Include="github_icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Glass\Glass.csproj">
@ -105,6 +124,13 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\..\..\packages\Xunit.StaFact.0.1.36-beta\build\net45\Xunit.StaFact.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Xunit.StaFact.0.1.36-beta\build\net45\Xunit.StaFact.props'))" />
</Target>
<!-- 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">

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
<package id="Xunit.StaFact" version="0.1.36-beta" targetFramework="net45" />
</packages>