зеркало из https://github.com/AvaloniaUI/OmniXAML.git
Merge pull request #98 from wieslawsoltes/TestsFix
@wieslawsoltes: Migrated to XUnit and fixed tests
This commit is contained in:
Коммит
e7e851f8e5
|
@ -1,30 +1,28 @@
|
||||||
namespace Glass.Tests
|
namespace Glass.Tests
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class AutoKeyDictionaryTests
|
public class AutoKeyDictionaryTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void IndexerTestKeyExist()
|
public void IndexerTestKeyExist()
|
||||||
{
|
{
|
||||||
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
|
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
|
||||||
var value = "Pepito";
|
var value = "Pepito";
|
||||||
sut.Add(2, value);
|
sut.Add(2, value);
|
||||||
var result = sut[1];
|
var result = sut[1];
|
||||||
Assert.AreEqual(value, result);
|
Assert.Equal(value, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof(KeyNotFoundException))]
|
|
||||||
public void IndexerTestKeyDoesNotExist()
|
public void IndexerTestKeyDoesNotExist()
|
||||||
{
|
{
|
||||||
var sut = new AutoKeyDictionary<int?, string>(i => i + 1, i => i < 2);
|
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()
|
public void TryGetTestKeyExist()
|
||||||
{
|
{
|
||||||
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
|
var sut = new AutoKeyDictionary<int, string>(i => i + 1, i => i < 3);
|
||||||
|
@ -32,7 +30,7 @@
|
||||||
sut.Add(2, expected);
|
sut.Add(2, expected);
|
||||||
string actual;
|
string actual;
|
||||||
var result = sut.TryGetValue(1, out actual);
|
var result = sut.TryGetValue(1, out actual);
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,12 +2,11 @@
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using Glass.ChangeTracking;
|
using Glass.ChangeTracking;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ObservablePropertyChainTests
|
public class ObservablePropertyChainTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SubscriptionToOneLevelPath()
|
public void SubscriptionToOneLevelPath()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel();
|
var changeSource = new DummyViewModel();
|
||||||
|
@ -17,10 +16,10 @@
|
||||||
sut.Subscribe(o => actualText = o);
|
sut.Subscribe(o => actualText = o);
|
||||||
changeSource.Text = "Hello world";
|
changeSource.Text = "Hello world";
|
||||||
|
|
||||||
Assert.AreEqual("Hello world", actualText);
|
Assert.Equal("Hello world", actualText);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SubscriptionToTwoLevelPath()
|
public void SubscriptionToTwoLevelPath()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel { Child = new DummyViewModel() };
|
var changeSource = new DummyViewModel { Child = new DummyViewModel() };
|
||||||
|
@ -30,10 +29,10 @@
|
||||||
sut.Subscribe(o => actualText = o);
|
sut.Subscribe(o => actualText = o);
|
||||||
changeSource.Child.Text = "Hello world";
|
changeSource.Child.Text = "Hello world";
|
||||||
|
|
||||||
Assert.AreEqual("Hello world", actualText);
|
Assert.Equal("Hello world", actualText);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GivenSubscriptionToTwoLevelPath_WhenRootChanges_NotificationsShouldArrive()
|
public void GivenSubscriptionToTwoLevelPath_WhenRootChanges_NotificationsShouldArrive()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
|
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
|
||||||
|
@ -43,10 +42,10 @@
|
||||||
sut.Subscribe(o => actualText = o);
|
sut.Subscribe(o => actualText = o);
|
||||||
changeSource.Child = new DummyViewModel { Text = "This is the real thing" };
|
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()
|
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesButValuesAreSame_NoNotificationAreReceived()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Same" } };
|
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Same" } };
|
||||||
|
@ -56,10 +55,10 @@
|
||||||
sut.Subscribe(o => hit = true);
|
sut.Subscribe(o => hit = true);
|
||||||
changeSource.Child = new DummyViewModel { Text = "Same" };
|
changeSource.Child = new DummyViewModel { Text = "Same" };
|
||||||
|
|
||||||
Assert.IsFalse(hit);
|
Assert.False(hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesInDifferentSteps_NotificationsShouldArrive()
|
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesInDifferentSteps_NotificationsShouldArrive()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
|
var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } };
|
||||||
|
@ -70,34 +69,34 @@
|
||||||
changeSource.Child = new DummyViewModel();
|
changeSource.Child = new DummyViewModel();
|
||||||
changeSource.Child.Text = "This is the real thing";
|
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()
|
public void GivenSubscriptionToTwoLevelPathToStruct_RetrievesTheCorrectValue()
|
||||||
{
|
{
|
||||||
var changeSource = new DummyViewModel { Child = new DummyViewModel { MyStruct = new MyStruct { Text = "My text" } } };
|
var changeSource = new DummyViewModel { Child = new DummyViewModel { MyStruct = new MyStruct { Text = "My text" } } };
|
||||||
var sut = new ObservablePropertyChain(changeSource, "Child.MyStruct.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()
|
public void ValueTypeChain_WithOneLevel_ValueIsAccessed()
|
||||||
{
|
{
|
||||||
var root = new MyStruct { Text = "Hello" };
|
var root = new MyStruct { Text = "Hello" };
|
||||||
var sut = new ValueTypePropertyChain(root, "Text");
|
var sut = new ValueTypePropertyChain(root, "Text");
|
||||||
|
|
||||||
Assert.AreEqual("Hello", sut.Value);
|
Assert.Equal("Hello", sut.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ValueTypeChain_WithTwoLevels_ValueIsAccessed()
|
public void ValueTypeChain_WithTwoLevels_ValueIsAccessed()
|
||||||
{
|
{
|
||||||
var root = new MyStruct { Child = new ChildStruct { Text = "Some text" } };
|
var root = new MyStruct { Child = new ChildStruct { Text = "Some text" } };
|
||||||
var sut = new ValueTypePropertyChain(root, "Child.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.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class DependencyResolverTest
|
public class DependencyResolverTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortTest()
|
public void SortTest()
|
||||||
{
|
{
|
||||||
var a = new Node("A");
|
var a = new Node("A");
|
||||||
|
@ -25,10 +24,10 @@
|
||||||
var expected = new List<Node> { d, e, c, b, a };
|
var expected = new List<Node> { d, e, c, b, a };
|
||||||
|
|
||||||
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
|
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()
|
public void SimpleTest()
|
||||||
{
|
{
|
||||||
var prop = new Node("Property");
|
var prop = new Node("Property");
|
||||||
|
@ -39,10 +38,10 @@
|
||||||
var expected = new List<Node> { prop, val };
|
var expected = new List<Node> { prop, val };
|
||||||
|
|
||||||
var actual = DependencySorter.SortDependencies(new Collection<Node> { prop, val }).ToList();
|
var actual = DependencySorter.SortDependencies(new Collection<Node> { prop, val }).ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void AlreadySorted()
|
public void AlreadySorted()
|
||||||
{
|
{
|
||||||
var a = new Node("A");
|
var a = new Node("A");
|
||||||
|
@ -60,10 +59,10 @@
|
||||||
var expected = new List<Node> { a, b, c, d, e };
|
var expected = new List<Node> { a, b, c, d, e };
|
||||||
|
|
||||||
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
|
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()
|
public void PartiallySorted()
|
||||||
{
|
{
|
||||||
var a = new Node("A");
|
var a = new Node("A");
|
||||||
|
@ -81,11 +80,10 @@
|
||||||
var expected = new List<Node> { a, b, c, e, d };
|
var expected = new List<Node> { a, b, c, e, d };
|
||||||
|
|
||||||
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
|
var actual = DependencySorter.SortDependencies(new Collection<Node> { a, b, c, d, e }).ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof(InvalidOperationException))]
|
|
||||||
public void CircularDependency()
|
public void CircularDependency()
|
||||||
{
|
{
|
||||||
var a = new Node("A");
|
var a = new Node("A");
|
||||||
|
@ -99,7 +97,7 @@
|
||||||
c.Dependencies = new Collection<Node> { d, e };
|
c.Dependencies = new Collection<Node> { d, e };
|
||||||
e.Dependencies = new Collection<Node> { a };
|
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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -8,7 +9,7 @@
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Glass.Tests</RootNamespace>
|
<RootNamespace>Glass.Tests</RootNamespace>
|
||||||
<AssemblyName>Glass.Tests</AssemblyName>
|
<AssemblyName>Glass.Tests</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
<TestProjectType>UnitTest</TestProjectType>
|
<TestProjectType>UnitTest</TestProjectType>
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -50,6 +52,22 @@
|
||||||
<HintPath>..\..\..\packages\Rx-Linq.2.3.0-beta2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
<HintPath>..\..\..\packages\Rx-Linq.2.3.0-beta2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</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>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
<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" />
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
</When>
|
||||||
<Otherwise>
|
<Otherwise />
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ChangeTracking\DummyViewModel.cs" />
|
<Compile Include="ChangeTracking\DummyViewModel.cs" />
|
||||||
|
@ -104,6 +118,12 @@
|
||||||
</Choose>
|
</Choose>
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0"/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0"/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0"/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</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-Core" version="2.3.0-beta2" targetFramework="net452" />
|
||||||
<package id="Rx-Interfaces" 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="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>
|
</packages>
|
|
@ -1,7 +1,7 @@
|
||||||
namespace OmniXaml.Services.DotNetFx.Tests
|
namespace OmniXaml.Services.DotNetFx.Tests
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Tests.Classes;
|
using OmniXaml.Tests.Classes;
|
||||||
using OmniXaml.Tests.Classes.WpfLikeModel;
|
using OmniXaml.Tests.Classes.WpfLikeModel;
|
||||||
using OmniXaml.Tests.Common.DotNetFx;
|
using OmniXaml.Tests.Common.DotNetFx;
|
||||||
|
@ -9,19 +9,16 @@
|
||||||
using Services.DotNetFx;
|
using Services.DotNetFx;
|
||||||
using Services.Tests;
|
using Services.Tests;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
[Ignore]
|
|
||||||
public class InflatableFactoryTest
|
public class InflatableFactoryTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact(Skip = "Ignore")]
|
||||||
|
|
||||||
public void Window()
|
public void Window()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
|
||||||
var myWindow = sut.Create<MyWindow>();
|
var myWindow = sut.Create<MyWindow>();
|
||||||
Assert.IsInstanceOfType(myWindow, typeof (MyWindow));
|
Assert.IsType(typeof (MyWindow), myWindow);
|
||||||
Assert.AreEqual(myWindow.Title, "Hello World :)");
|
Assert.Equal(myWindow.Title, "Hello World :)");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AutoInflatingTypeFactory CreateSut()
|
private static AutoInflatingTypeFactory CreateSut()
|
||||||
|
@ -34,30 +31,30 @@
|
||||||
return inflatableTypeFactory;
|
return inflatableTypeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact(Skip = "Ignore")]
|
||||||
public void UserControl()
|
public void UserControl()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
|
||||||
var myWindow = sut.Create<WindowWithUserControl>();
|
var myWindow = sut.Create<WindowWithUserControl>();
|
||||||
Assert.IsInstanceOfType(myWindow, typeof (WindowWithUserControl));
|
Assert.IsType(typeof (WindowWithUserControl), myWindow);
|
||||||
Assert.AreEqual(myWindow.Title, "Hello World :)");
|
Assert.Equal(myWindow.Title, "Hello World :)");
|
||||||
Assert.IsInstanceOfType(myWindow.Content, typeof (UserControl));
|
Assert.IsType(typeof (UserControl), myWindow.Content);
|
||||||
Assert.AreEqual("It's-a me, Mario", ((UserControl) myWindow.Content).Property);
|
Assert.Equal("It's-a me, Mario", ((UserControl) myWindow.Content).Property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact(Skip = "Ignore")]
|
||||||
public void UserControlLoadingWithUri()
|
public void UserControlLoadingWithUri()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
|
||||||
var myWindow = (Window) sut.Create(new Uri("WpfLikeModel/WindowWithUserControl.xaml", UriKind.Relative));
|
var myWindow = (Window) sut.Create(new Uri("WpfLikeModel/WindowWithUserControl.xaml", UriKind.Relative));
|
||||||
Assert.IsInstanceOfType(myWindow, typeof (WindowWithUserControl));
|
Assert.IsType(typeof (WindowWithUserControl), myWindow);
|
||||||
Assert.AreEqual(myWindow.Title, "Hello World :)");
|
Assert.Equal(myWindow.Title, "Hello World :)");
|
||||||
Assert.IsInstanceOfType(myWindow.Content, typeof (UserControl));
|
Assert.IsType(typeof (UserControl), myWindow.Content);
|
||||||
var userControl = (UserControl) myWindow.Content;
|
var userControl = (UserControl) myWindow.Content;
|
||||||
Assert.AreEqual("It's-a me, Mario", userControl.Property);
|
Assert.Equal("It's-a me, Mario", userControl.Property);
|
||||||
Assert.IsInstanceOfType(userControl.Content, typeof (ChildClass));
|
Assert.IsType(typeof (ChildClass), userControl.Content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -38,6 +39,22 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<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>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
<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" />
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
</When>
|
||||||
<Otherwise>
|
<Otherwise />
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="InflatableFactoryTest.cs" />
|
<Compile Include="InflatableFactoryTest.cs" />
|
||||||
|
@ -94,7 +107,7 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||||
|
@ -116,6 +129,12 @@
|
||||||
</Choose>
|
</Choose>
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<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
|
namespace OmniXaml.Services.Tests
|
||||||
{
|
{
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using OmniXaml.Tests.Classes.WpfLikeModel;
|
using OmniXaml.Tests.Classes.WpfLikeModel;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class InflatableTests : GivenAnInflatableTypeLoader
|
public class InflatableTests : GivenAnInflatableTypeLoader
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact(Skip = "Ignore")]
|
||||||
public void InflatableInDataTemplateTest()
|
public void InflatableInDataTemplateTest()
|
||||||
{
|
{
|
||||||
var actualInstance = TypeFactory.Create<WindowWithTemplateAndUserControl>();
|
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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -43,16 +43,16 @@
|
||||||
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.assert.2.2.0-beta1-build3239\lib\dotnet\xunit.assert.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.extensibility.core.2.2.0-beta1-build3239\lib\dotnet\xunit.core.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.execution.desktop, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.2.0-beta1-build3239\lib\net45\xunit.execution.desktop.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -62,13 +62,7 @@
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
</When>
|
||||||
<Otherwise>
|
<Otherwise />
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ObjectAssemblerAdvancedNamescopeTests.cs" />
|
<Compile Include="ObjectAssemblerAdvancedNamescopeTests.cs" />
|
||||||
|
@ -136,7 +130,7 @@
|
||||||
<PropertyGroup>
|
<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>
|
<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>
|
</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>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<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.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.extensibility.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.extensibility.execution" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="2.2.0-beta1-build1144" targetFramework="net45" developmentDependency="true" />
|
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -2,12 +2,11 @@
|
||||||
{
|
{
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Builder;
|
using Builder;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ConfiguredAssemblyWithNamespacesTests
|
public class ConfiguredAssemblyWithNamespacesTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LooksInCorrectNamespace()
|
public void LooksInCorrectNamespace()
|
||||||
{
|
{
|
||||||
var expectedType = typeof(OmniXaml.Tests.Classes.Another.DummyChild);
|
var expectedType = typeof(OmniXaml.Tests.Classes.Another.DummyChild);
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
|
|
||||||
var result = can.Get("DummyChild");
|
var result = can.Get("DummyChild");
|
||||||
|
|
||||||
Assert.AreEqual(expectedType, result);
|
Assert.Equal(expectedType, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Resources;
|
using Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class InstructionTreeBuilderTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class InstructionTreeBuilderTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly InstructionResources source;
|
private readonly InstructionResources source;
|
||||||
|
@ -18,7 +17,7 @@
|
||||||
source = new InstructionResources(this);
|
source = new InstructionResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void InstructionToNodeConversionWithLeadingAndTrailing()
|
public void InstructionToNodeConversionWithLeadingAndTrailing()
|
||||||
{
|
{
|
||||||
var input = new List<Instruction>
|
var input = new List<Instruction>
|
||||||
|
@ -38,10 +37,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void InstructionToNodeConversionWithLeadingBodyAndTrailing()
|
public void InstructionToNodeConversionWithLeadingBodyAndTrailing()
|
||||||
{
|
{
|
||||||
var input = new List<Instruction>
|
var input = new List<Instruction>
|
||||||
|
@ -73,10 +72,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TestReverseMembers()
|
public void TestReverseMembers()
|
||||||
{
|
{
|
||||||
var input = source.TestReverseMembers;
|
var input = source.TestReverseMembers;
|
||||||
|
@ -90,10 +89,10 @@
|
||||||
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
||||||
var expectedInstructions = source.TestReverseMembersReverted;
|
var expectedInstructions = source.TestReverseMembersReverted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TestReverseMembersWithCollection()
|
public void TestReverseMembersWithCollection()
|
||||||
{
|
{
|
||||||
var input = source.TestReverseMembers;
|
var input = source.TestReverseMembers;
|
||||||
|
@ -107,10 +106,10 @@
|
||||||
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
||||||
var expectedInstructions = source.TestReverseMembersReverted;
|
var expectedInstructions = source.TestReverseMembersReverted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DependencySorting()
|
public void DependencySorting()
|
||||||
{
|
{
|
||||||
var input = source.TwoMembers;
|
var input = source.TwoMembers;
|
||||||
|
@ -124,11 +123,11 @@
|
||||||
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
var actualNodes = h.Children.SelectMany(node => node.Dump());
|
||||||
var expectedInstructions = source.TwoMembersReversed;
|
var expectedInstructions = source.TwoMembersReversed;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GivenCollectionAndSimpleMember_AfterCreatingHierarchy_DumpReturnsTheOriginalInput()
|
public void GivenCollectionAndSimpleMember_AfterCreatingHierarchy_DumpReturnsTheOriginalInput()
|
||||||
{
|
{
|
||||||
var sut = new InstructionTreeBuilder();
|
var sut = new InstructionTreeBuilder();
|
||||||
|
@ -137,7 +136,7 @@
|
||||||
|
|
||||||
var nodes = instructionNodes.SelectMany(node => node.Dump()).ToList();
|
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;
|
||||||
using Classes.WpfLikeModel;
|
using Classes.WpfLikeModel;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Resources;
|
using Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class LookaheadBufferTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class LookaheadBufferTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly InstructionResources resources;
|
private readonly InstructionResources resources;
|
||||||
|
@ -18,7 +17,7 @@
|
||||||
resources = new InstructionResources(this);
|
resources = new InstructionResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LookAheadTest()
|
public void LookAheadTest()
|
||||||
{
|
{
|
||||||
var look = new List<Instruction>
|
var look = new List<Instruction>
|
||||||
|
@ -36,10 +35,10 @@
|
||||||
var enumerator = look.GetEnumerator();
|
var enumerator = look.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
||||||
Assert.AreEqual(8, count);
|
Assert.Equal(8, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LookAheadTestStartZero()
|
public void LookAheadTestStartZero()
|
||||||
{
|
{
|
||||||
var instructions = new List<Instruction>();
|
var instructions = new List<Instruction>();
|
||||||
|
@ -47,10 +46,10 @@
|
||||||
var enumerator = instructions.GetEnumerator();
|
var enumerator = instructions.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
||||||
Assert.AreEqual(0, count);
|
Assert.Equal(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LookAheadTestStartMiniumLength()
|
public void LookAheadTestStartMiniumLength()
|
||||||
{
|
{
|
||||||
var look = new List<Instruction>
|
var look = new List<Instruction>
|
||||||
|
@ -62,10 +61,10 @@
|
||||||
var enumerator = look.GetEnumerator();
|
var enumerator = look.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
||||||
Assert.AreEqual(2, count);
|
Assert.Equal(2, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LookAheadTest10()
|
public void LookAheadTest10()
|
||||||
{
|
{
|
||||||
var look = new List<Instruction>
|
var look = new List<Instruction>
|
||||||
|
@ -85,10 +84,10 @@
|
||||||
var enumerator = look.GetEnumerator();
|
var enumerator = look.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
||||||
Assert.AreEqual(10, count);
|
Assert.Equal(10, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LookAheadTestWithGetObjectAndCollection()
|
public void LookAheadTestWithGetObjectAndCollection()
|
||||||
{
|
{
|
||||||
var look = resources.ComboBoxUnsorted;
|
var look = resources.ComboBoxUnsorted;
|
||||||
|
@ -103,7 +102,7 @@
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
var count = LookaheadBuffer.GetUntilEndOfRoot(enumerator).Count();
|
||||||
|
|
||||||
Assert.AreEqual(expectedCount, count);
|
Assert.Equal(expectedCount, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,10 +4,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Resources;
|
using Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class MemberDependencyNodeSorterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class MemberDependencyNodeSorterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly MemberDependencyNodeSorter memberDependencyNodeSorter = new MemberDependencyNodeSorter();
|
private readonly MemberDependencyNodeSorter memberDependencyNodeSorter = new MemberDependencyNodeSorter();
|
||||||
|
@ -18,7 +17,7 @@
|
||||||
resources = new InstructionResources(this);
|
resources = new InstructionResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortWholeStyle()
|
public void SortWholeStyle()
|
||||||
{
|
{
|
||||||
var input = resources.StyleUnsorted;
|
var input = resources.StyleUnsorted;
|
||||||
|
@ -27,11 +26,11 @@
|
||||||
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
||||||
var expectedInstructions = resources.StyleSorted;
|
var expectedInstructions = resources.StyleSorted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortSetter()
|
public void SortSetter()
|
||||||
{
|
{
|
||||||
var input = resources.SetterUnsorted;
|
var input = resources.SetterUnsorted;
|
||||||
|
@ -40,10 +39,10 @@
|
||||||
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
||||||
var expectedInstructions = resources.SetterSorted;
|
var expectedInstructions = resources.SetterSorted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortComboBox()
|
public void SortComboBox()
|
||||||
{
|
{
|
||||||
var input = resources.ComboBoxUnsorted;
|
var input = resources.ComboBoxUnsorted;
|
||||||
|
@ -52,10 +51,10 @@
|
||||||
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
||||||
var expectedInstructions = resources.ComboBoxSorted;
|
var expectedInstructions = resources.ComboBoxSorted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortTwoComboBoxes()
|
public void SortTwoComboBoxes()
|
||||||
{
|
{
|
||||||
var input = resources.TwoComboBoxesUnsorted;
|
var input = resources.TwoComboBoxesUnsorted;
|
||||||
|
@ -64,10 +63,10 @@
|
||||||
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
||||||
var expectedInstructions = resources.TwoComboBoxesSorted;
|
var expectedInstructions = resources.TwoComboBoxesSorted;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SortMarkupExtension()
|
public void SortMarkupExtension()
|
||||||
{
|
{
|
||||||
var input = resources.ListBoxSortedWithExtension;
|
var input = resources.ListBoxSortedWithExtension;
|
||||||
|
@ -76,7 +75,7 @@
|
||||||
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
var actualNodes = memberDependencyNodeSorter.Sort(enumerator).ToList();
|
||||||
var expectedInstructions = resources.ListBoxSortedWithExtension;
|
var expectedInstructions = resources.ListBoxSortedWithExtension;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,16 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Builder;
|
using Builder;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Typing;
|
using Typing;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class NamespaceRegistryTests
|
public class NamespaceRegistryTests
|
||||||
{
|
{
|
||||||
private NamespaceRegistry registry;
|
private NamespaceRegistry registry;
|
||||||
private Type type;
|
private Type type;
|
||||||
private string clrNamespace;
|
private string clrNamespace;
|
||||||
|
|
||||||
[TestInitialize]
|
public NamespaceRegistryTests()
|
||||||
public void Initialize()
|
|
||||||
{
|
{
|
||||||
type = typeof(DummyClass);
|
type = typeof(DummyClass);
|
||||||
registry = new NamespaceRegistry();
|
registry = new NamespaceRegistry();
|
||||||
|
@ -29,40 +27,40 @@
|
||||||
.With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) }));
|
.With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void RegisterPrefixTest()
|
public void RegisterPrefixTest()
|
||||||
{
|
{
|
||||||
CollectionAssert.AreEqual(
|
Assert.Equal(
|
||||||
registry.RegisteredPrefixes.ToList(),
|
registry.RegisteredPrefixes.ToList(),
|
||||||
new Collection<PrefixRegistration> {new PrefixRegistration("my", "target"), new PrefixRegistration("clr", clrNamespace)});
|
new Collection<PrefixRegistration> {new PrefixRegistration("my", "target"), new PrefixRegistration("clr", clrNamespace)});
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetClrNsByPrefix()
|
public void GetClrNsByPrefix()
|
||||||
{
|
{
|
||||||
var clrNs = registry.GetClrNamespaceByPrefix("clr");
|
var clrNs = registry.GetClrNamespaceByPrefix("clr");
|
||||||
var expected = new ClrNamespace(type.GetTypeInfo().Assembly, type.Namespace);
|
var expected = new ClrNamespace(type.GetTypeInfo().Assembly, type.Namespace);
|
||||||
Assert.AreEqual(expected, clrNs);
|
Assert.Equal(expected, clrNs);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetXamlNamespaceOfNotRegisteredPrefix()
|
public void GetXamlNamespaceOfNotRegisteredPrefix()
|
||||||
{
|
{
|
||||||
Assert.IsNull(registry.GetXamlNamespace("unknown_namespace"));
|
Assert.Null(registry.GetXamlNamespace("unknown_namespace"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetNamespaceByPrefix()
|
public void GetNamespaceByPrefix()
|
||||||
{
|
{
|
||||||
var ns = registry.GetXamlNamespaceByPrefix("my");
|
var ns = registry.GetXamlNamespaceByPrefix("my");
|
||||||
Assert.AreEqual("target", ns.Name);
|
Assert.Equal("target", ns.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetNamespace()
|
public void GetNamespace()
|
||||||
{
|
{
|
||||||
var ns = registry.GetXamlNamespace("target");
|
var ns = registry.GetXamlNamespace("target");
|
||||||
Assert.AreEqual("target", ns.Name);
|
Assert.Equal("target", ns.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,11 @@
|
||||||
using Classes;
|
using Classes;
|
||||||
using Classes.WpfLikeModel;
|
using Classes.WpfLikeModel;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using ObjectAssembler;
|
using ObjectAssembler;
|
||||||
using Resources;
|
using Resources;
|
||||||
using TypeConversion;
|
using TypeConversion;
|
||||||
using Xunit;
|
|
||||||
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
|
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class ObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private InstructionResources source;
|
private InstructionResources source;
|
||||||
|
@ -21,11 +18,6 @@
|
||||||
public ObjectAssemblerTests()
|
public ObjectAssemblerTests()
|
||||||
{
|
{
|
||||||
source = new InstructionResources(this);
|
source = new InstructionResources(this);
|
||||||
}
|
|
||||||
|
|
||||||
[TestInitialize]
|
|
||||||
public void Initialize()
|
|
||||||
{
|
|
||||||
sut = CreateSut();
|
sut = CreateSut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,17 +39,17 @@
|
||||||
return assembler;
|
return assembler;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void OneObject()
|
public void OneObject()
|
||||||
{
|
{
|
||||||
sut.Process(source.OneObject);
|
sut.Process(source.OneObject);
|
||||||
|
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ObjectWithMember()
|
public void ObjectWithMember()
|
||||||
{
|
{
|
||||||
sut.Process(source.ObjectWithMember);
|
sut.Process(source.ObjectWithMember);
|
||||||
|
@ -65,8 +57,8 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).SampleProperty;
|
var property = ((DummyClass)result).SampleProperty;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual("Property!", property);
|
Assert.Equal("Property!", property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -78,8 +70,8 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).EnumProperty;
|
var property = ((DummyClass)result).EnumProperty;
|
||||||
|
|
||||||
Xunit.Assert.IsType<DummyClass>(result);
|
Assert.IsType<DummyClass>(result);
|
||||||
Xunit.Assert.Equal(SomeEnum.One, property);
|
Assert.Equal(SomeEnum.One, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -91,11 +83,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).EnumProperty;
|
var property = ((DummyClass)result).EnumProperty;
|
||||||
|
|
||||||
Xunit.Assert.IsType<DummyClass>(result);
|
Assert.IsType<DummyClass>(result);
|
||||||
Xunit.Assert.Equal(SomeEnum.One, property);
|
Assert.Equal(SomeEnum.One, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ObjectWithTwoMembers()
|
public void ObjectWithTwoMembers()
|
||||||
{
|
{
|
||||||
sut.Process(source.ObjectWithTwoMembers);
|
sut.Process(source.ObjectWithTwoMembers);
|
||||||
|
@ -104,12 +96,12 @@
|
||||||
var property1 = ((DummyClass)result).SampleProperty;
|
var property1 = ((DummyClass)result).SampleProperty;
|
||||||
var property2 = ((DummyClass)result).AnotherProperty;
|
var property2 = ((DummyClass)result).AnotherProperty;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual("Property!", property1);
|
Assert.Equal("Property!", property1);
|
||||||
Assert.AreEqual("Another!", property2);
|
Assert.Equal("Another!", property2);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ObjectWithChild()
|
public void ObjectWithChild()
|
||||||
{
|
{
|
||||||
sut.Process(source.ObjectWithChild);
|
sut.Process(source.ObjectWithChild);
|
||||||
|
@ -117,11 +109,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).Child;
|
var property = ((DummyClass)result).Child;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.IsInstanceOfType(property, typeof(ChildClass));
|
Assert.IsType(typeof(ChildClass), property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void WithCollection()
|
public void WithCollection()
|
||||||
{
|
{
|
||||||
sut.Process(source.CollectionWithMoreThanOneItem);
|
sut.Process(source.CollectionWithMoreThanOneItem);
|
||||||
|
@ -129,12 +121,12 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var children = ((DummyClass)result).Items;
|
var children = ((DummyClass)result).Items;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual(3, children.Count);
|
Assert.Equal(3, children.Count);
|
||||||
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
|
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollectionWithInnerCollection()
|
public void CollectionWithInnerCollection()
|
||||||
{
|
{
|
||||||
sut.Process(source.CollectionWithInnerCollection);
|
sut.Process(source.CollectionWithInnerCollection);
|
||||||
|
@ -142,15 +134,15 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var children = ((DummyClass)result).Items;
|
var children = ((DummyClass)result).Items;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual(3, children.Count);
|
Assert.Equal(3, children.Count);
|
||||||
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
|
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
|
||||||
var innerCollection = children[0].Children;
|
var innerCollection = children[0].Children;
|
||||||
Assert.AreEqual(2, innerCollection.Count);
|
Assert.Equal(2, innerCollection.Count);
|
||||||
CollectionAssert.AllItemsAreInstancesOfType(innerCollection, typeof(Item));
|
Assert.All(innerCollection, (child) => Assert.IsType(typeof(Item), child));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void WithCollectionAndInnerAttribute()
|
public void WithCollectionAndInnerAttribute()
|
||||||
{
|
{
|
||||||
sut.Process(source.WithCollectionAndInnerAttribute);
|
sut.Process(source.WithCollectionAndInnerAttribute);
|
||||||
|
@ -160,12 +152,12 @@
|
||||||
var firstChild = children.First();
|
var firstChild = children.First();
|
||||||
var property = firstChild.Title;
|
var property = firstChild.Title;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
CollectionAssert.AllItemsAreInstancesOfType(children, typeof(Item));
|
Assert.All(children, (child) => Assert.IsType(typeof(Item), child));
|
||||||
Assert.AreEqual("SomeText", property);
|
Assert.Equal("SomeText", property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MemberWithIncompatibleTypes()
|
public void MemberWithIncompatibleTypes()
|
||||||
{
|
{
|
||||||
sut.Process(source.MemberWithIncompatibleTypes);
|
sut.Process(source.MemberWithIncompatibleTypes);
|
||||||
|
@ -173,11 +165,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).Number;
|
var property = ((DummyClass)result).Number;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual(12, property);
|
Assert.Equal(12, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionWithArgument()
|
public void ExtensionWithArgument()
|
||||||
{
|
{
|
||||||
sut.Process(source.ExtensionWithArgument);
|
sut.Process(source.ExtensionWithArgument);
|
||||||
|
@ -185,11 +177,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).SampleProperty;
|
var property = ((DummyClass)result).SampleProperty;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual("Option", property);
|
Assert.Equal("Option", property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionWithTwoArguments()
|
public void ExtensionWithTwoArguments()
|
||||||
{
|
{
|
||||||
sut.Process(source.ExtensionWithTwoArguments);
|
sut.Process(source.ExtensionWithTwoArguments);
|
||||||
|
@ -197,11 +189,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).SampleProperty;
|
var property = ((DummyClass)result).SampleProperty;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual("OneSecond", property);
|
Assert.Equal("OneSecond", property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionThatReturnsNull()
|
public void ExtensionThatReturnsNull()
|
||||||
{
|
{
|
||||||
sut.Process(source.ExtensionThatReturnsNull);
|
sut.Process(source.ExtensionThatReturnsNull);
|
||||||
|
@ -209,11 +201,11 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).SampleProperty;
|
var property = ((DummyClass)result).SampleProperty;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.IsNull(property);
|
Assert.Null(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionWithNonStringArgument()
|
public void ExtensionWithNonStringArgument()
|
||||||
{
|
{
|
||||||
sut.Process(source.ExtensionWithNonStringArgument);
|
sut.Process(source.ExtensionWithNonStringArgument);
|
||||||
|
@ -221,22 +213,22 @@
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var property = ((DummyClass)result).Number;
|
var property = ((DummyClass)result).Number;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(result, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), result);
|
||||||
Assert.AreEqual(123, property);
|
Assert.Equal(123, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void KeyDirective()
|
public void KeyDirective()
|
||||||
{
|
{
|
||||||
sut.Process(source.KeyDirective);
|
sut.Process(source.KeyDirective);
|
||||||
|
|
||||||
var actual = sut.Result;
|
var actual = sut.Result;
|
||||||
Assert.IsInstanceOfType(actual, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), actual);
|
||||||
var dictionary = (IDictionary)((DummyClass)actual).Resources;
|
var dictionary = (IDictionary)((DummyClass)actual).Resources;
|
||||||
Assert.IsTrue(dictionary.Count > 0);
|
Assert.True(dictionary.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void String()
|
public void String()
|
||||||
{
|
{
|
||||||
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
|
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
|
||||||
|
@ -244,12 +236,12 @@
|
||||||
sut.Process(source.GetString(sysNs));
|
sut.Process(source.GetString(sysNs));
|
||||||
|
|
||||||
var actual = sut.Result;
|
var actual = sut.Result;
|
||||||
Assert.IsInstanceOfType(actual, typeof(string));
|
Assert.IsType(typeof(string), actual);
|
||||||
Assert.AreEqual("Text", actual);
|
Assert.Equal("Text", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TopDownContainsOuterObject()
|
public void TopDownContainsOuterObject()
|
||||||
{
|
{
|
||||||
sut.Process(source.InstanceWithChild);
|
sut.Process(source.InstanceWithChild);
|
||||||
|
@ -257,51 +249,49 @@
|
||||||
var dummyClassXamlType = RuntimeTypeSource.GetByType(typeof(DummyClass));
|
var dummyClassXamlType = RuntimeTypeSource.GetByType(typeof(DummyClass));
|
||||||
var lastInstance = sut.TopDownValueContext.GetLastInstance(dummyClassXamlType);
|
var lastInstance = sut.TopDownValueContext.GetLastInstance(dummyClassXamlType);
|
||||||
|
|
||||||
Assert.IsInstanceOfType(lastInstance, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), lastInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof(ParseException))]
|
|
||||||
public void AttemptToAssignItemsToNonCollectionMember()
|
public void AttemptToAssignItemsToNonCollectionMember()
|
||||||
{
|
{
|
||||||
sut.Process(source.AttemptToAssignItemsToNonCollectionMember);
|
Assert.Throws<ParseException>(() => sut.Process(source.AttemptToAssignItemsToNonCollectionMember));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof(ParseException))]
|
|
||||||
public void TwoChildrenWithNoRoot_ShouldThrow()
|
public void TwoChildrenWithNoRoot_ShouldThrow()
|
||||||
{
|
{
|
||||||
sut.Process(source.TwoRoots);
|
Assert.Throws<ParseException>(() => sut.Process(source.TwoRoots));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void PropertyShouldBeAssignedBeforeChildIsAssociatedToItsParent()
|
public void PropertyShouldBeAssignedBeforeChildIsAssociatedToItsParent()
|
||||||
{
|
{
|
||||||
sut.Process(source.ParentShouldReceiveInitializedChild);
|
sut.Process(source.ParentShouldReceiveInitializedChild);
|
||||||
var parent = (SpyingParent)sut.Result;
|
var parent = (SpyingParent)sut.Result;
|
||||||
Assert.IsTrue(parent.ChildHadNamePriorToBeingAssigned);
|
Assert.True(parent.ChildHadNamePriorToBeingAssigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MixedCollection()
|
public void MixedCollection()
|
||||||
{
|
{
|
||||||
sut.Process(source.MixedCollection);
|
sut.Process(source.MixedCollection);
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
Assert.IsInstanceOfType(result, typeof(ArrayList));
|
Assert.IsType(typeof(ArrayList), result);
|
||||||
var arrayList = (ArrayList)result;
|
var arrayList = (ArrayList)result;
|
||||||
Assert.IsTrue(arrayList.Count > 0);
|
Assert.True(arrayList.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MixedCollectionWithRootInstance()
|
public void MixedCollectionWithRootInstance()
|
||||||
{
|
{
|
||||||
var root = new ArrayList();
|
var root = new ArrayList();
|
||||||
var assembler = CreateSutForLoadingSpecificInstance(root);
|
var assembler = CreateSutForLoadingSpecificInstance(root);
|
||||||
assembler.Process(source.MixedCollection);
|
assembler.Process(source.MixedCollection);
|
||||||
var result = assembler.Result;
|
var result = assembler.Result;
|
||||||
Assert.IsInstanceOfType(result, typeof(ArrayList));
|
Assert.IsType(typeof(ArrayList), result);
|
||||||
var arrayList = (ArrayList)result;
|
var arrayList = (ArrayList)result;
|
||||||
Assert.IsTrue(arrayList.Count > 0);
|
Assert.True(arrayList.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -312,7 +302,7 @@
|
||||||
sut.Process(source.RootInstanceWithAttachableMember);
|
sut.Process(source.RootInstanceWithAttachableMember);
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var attachedProperty = Container.GetProperty(result);
|
var attachedProperty = Container.GetProperty(result);
|
||||||
Xunit.Assert.Equal("Value", attachedProperty);
|
Assert.Equal("Value", attachedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -325,8 +315,8 @@
|
||||||
|
|
||||||
var firstChild = items.First();
|
var firstChild = items.First();
|
||||||
var attachedProperty = Container.GetProperty(firstChild);
|
var attachedProperty = Container.GetProperty(firstChild);
|
||||||
Xunit.Assert.Equal(2, items.Count);
|
Assert.Equal(2, items.Count);
|
||||||
Xunit.Assert.Equal("Value", attachedProperty);
|
Assert.Equal("Value", attachedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -337,7 +327,7 @@
|
||||||
var instance = sut.Result;
|
var instance = sut.Result;
|
||||||
var col = Container.GetCollection(instance);
|
var col = Container.GetCollection(instance);
|
||||||
|
|
||||||
Xunit.Assert.NotEmpty(col);
|
Assert.NotEmpty(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -345,7 +335,7 @@
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
sut.Process(source.CustomCollection);
|
sut.Process(source.CustomCollection);
|
||||||
Xunit.Assert.NotEmpty((IEnumerable)sut.Result);
|
Assert.NotEmpty((IEnumerable)sut.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -354,7 +344,7 @@
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
sut.Process(source.PureCollection);
|
sut.Process(source.PureCollection);
|
||||||
var actual = (ArrayList)sut.Result;
|
var actual = (ArrayList)sut.Result;
|
||||||
Xunit.Assert.NotEmpty(actual);
|
Assert.NotEmpty(actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -366,7 +356,7 @@
|
||||||
|
|
||||||
var customCollection = actual.Collection;
|
var customCollection = actual.Collection;
|
||||||
|
|
||||||
Xunit.Assert.NotEmpty(customCollection);
|
Assert.NotEmpty(customCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -378,7 +368,7 @@
|
||||||
|
|
||||||
var customCollection = actual.Collection;
|
var customCollection = actual.Collection;
|
||||||
|
|
||||||
Xunit.Assert.NotEmpty(customCollection);
|
Assert.NotEmpty(customCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -388,7 +378,7 @@
|
||||||
sut.Process(source.ImplicitCollection);
|
sut.Process(source.ImplicitCollection);
|
||||||
var actual = (RootObject)sut.Result;
|
var actual = (RootObject)sut.Result;
|
||||||
|
|
||||||
Xunit.Assert.False(actual.CollectionWasReplaced);
|
Assert.False(actual.CollectionWasReplaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -398,20 +388,20 @@
|
||||||
sut.Process(source.ExplicitCollection);
|
sut.Process(source.ExplicitCollection);
|
||||||
var actual = (RootObject)sut.Result;
|
var actual = (RootObject)sut.Result;
|
||||||
|
|
||||||
Xunit.Assert.True(actual.CollectionWasReplaced);
|
Assert.True(actual.CollectionWasReplaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NamedObject_HasCorrectName()
|
public void NamedObject_HasCorrectName()
|
||||||
{
|
{
|
||||||
sut.Process(source.NamedObject);
|
sut.Process(source.NamedObject);
|
||||||
var result = sut.Result;
|
var result = sut.Result;
|
||||||
var tb = (TextBlock)result;
|
var tb = (TextBlock)result;
|
||||||
|
|
||||||
Assert.AreEqual("MyTextBlock", tb.Name);
|
Assert.Equal("MyTextBlock", tb.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TwoNestedNamedObjects_HaveCorrectNames()
|
public void TwoNestedNamedObjects_HaveCorrectNames()
|
||||||
{
|
{
|
||||||
sut.Process(source.TwoNestedNamedObjects);
|
sut.Process(source.TwoNestedNamedObjects);
|
||||||
|
@ -419,11 +409,11 @@
|
||||||
var lbi = (ListBoxItem)result;
|
var lbi = (ListBoxItem)result;
|
||||||
var textBlock = (TextBlock)lbi.Content;
|
var textBlock = (TextBlock)lbi.Content;
|
||||||
|
|
||||||
Assert.AreEqual("MyListBoxItem", lbi.Name);
|
Assert.Equal("MyListBoxItem", lbi.Name);
|
||||||
Assert.AreEqual("MyTextBlock", textBlock.Name);
|
Assert.Equal("MyTextBlock", textBlock.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ListBoxWithItemAndTextBlockNoNames()
|
public void ListBoxWithItemAndTextBlockNoNames()
|
||||||
{
|
{
|
||||||
sut.Process(source.ListBoxWithItemAndTextBlockNoNames);
|
sut.Process(source.ListBoxWithItemAndTextBlockNoNames);
|
||||||
|
@ -433,10 +423,10 @@
|
||||||
var lvi = (ListBoxItem)lb.Items.First();
|
var lvi = (ListBoxItem)lb.Items.First();
|
||||||
var tb = lvi.Content;
|
var tb = lvi.Content;
|
||||||
|
|
||||||
Assert.IsInstanceOfType(tb, typeof(TextBlock));
|
Assert.IsType(typeof(TextBlock), tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ListBoxWithItemAndTextBlockWithNames_HaveCorrectNames()
|
public void ListBoxWithItemAndTextBlockWithNames_HaveCorrectNames()
|
||||||
{
|
{
|
||||||
sut.Process(source.ListBoxWithItemAndTextBlockWithNames);
|
sut.Process(source.ListBoxWithItemAndTextBlockWithNames);
|
||||||
|
@ -446,28 +436,28 @@
|
||||||
var lvi = (ListBoxItem)lb.Items.First();
|
var lvi = (ListBoxItem)lb.Items.First();
|
||||||
var tb = (TextBlock)lvi.Content;
|
var tb = (TextBlock)lvi.Content;
|
||||||
|
|
||||||
Assert.AreEqual("MyListBox", lb.Name);
|
Assert.Equal("MyListBox", lb.Name);
|
||||||
Assert.AreEqual("MyListBoxItem", lvi.Name);
|
Assert.Equal("MyListBoxItem", lvi.Name);
|
||||||
Assert.AreEqual("MyTextBlock", tb.Name);
|
Assert.Equal("MyTextBlock", tb.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DirectContentForOneToMany()
|
public void DirectContentForOneToMany()
|
||||||
{
|
{
|
||||||
sut.Process(source.DirectContentForOneToMany);
|
sut.Process(source.DirectContentForOneToMany);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CorrectInstanceSetupSequence()
|
public void CorrectInstanceSetupSequence()
|
||||||
{
|
{
|
||||||
var expectedSequence = new[] { SetupSequence.Begin, SetupSequence.AfterSetProperties, SetupSequence.AfterAssociatedToParent, SetupSequence.End };
|
var expectedSequence = new[] { SetupSequence.Begin, SetupSequence.AfterSetProperties, SetupSequence.AfterAssociatedToParent, SetupSequence.End };
|
||||||
sut.Process(source.InstanceWithChild);
|
sut.Process(source.InstanceWithChild);
|
||||||
|
|
||||||
var listener = (TestListener)sut.LifecycleListener;
|
var listener = (TestListener)sut.LifecycleListener;
|
||||||
CollectionAssert.AreEqual(expectedSequence, listener.InvocationOrder);
|
Assert.Equal(expectedSequence.ToList().AsReadOnly(), listener.InvocationOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MemberAfterInitalizationValue()
|
public void MemberAfterInitalizationValue()
|
||||||
{
|
{
|
||||||
sut.Process(source.MemberAfterInitalizationValue);
|
sut.Process(source.MemberAfterInitalizationValue);
|
||||||
|
@ -476,8 +466,8 @@
|
||||||
var str = root.Collection[0];
|
var str = root.Collection[0];
|
||||||
var dummy = (DummyClass)root.Collection[1];
|
var dummy = (DummyClass)root.Collection[1];
|
||||||
|
|
||||||
Assert.AreEqual("foo", str);
|
Assert.Equal("foo", str);
|
||||||
Assert.AreEqual(123, dummy.Number);
|
Assert.Equal(123, dummy.Number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -54,16 +54,16 @@
|
||||||
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.assert.2.2.0-beta1-build3239\lib\dotnet\xunit.assert.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.extensibility.core.2.2.0-beta1-build3239\lib\dotnet\xunit.core.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.execution.desktop, Version=2.2.0.3239, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.2.0-beta1-build3239\lib\net45\xunit.execution.desktop.dll</HintPath>
|
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -73,13 +73,7 @@
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
</When>
|
||||||
<Otherwise>
|
<Otherwise />
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConfiguredAssemblyWithNamespacesTests.cs" />
|
<Compile Include="ConfiguredAssemblyWithNamespacesTests.cs" />
|
||||||
|
@ -175,7 +169,7 @@
|
||||||
<PropertyGroup>
|
<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>
|
<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>
|
</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>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Parsers.Parser;
|
using OmniXaml.Parsers.Parser;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class MarkupExtensionsParsingFromProtoToXaml : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class MarkupExtensionsParsingFromProtoToXaml : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly IInstructionParser sut;
|
private readonly IInstructionParser sut;
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
sut = new InstructionParser(RuntimeTypeSource);
|
sut = new InstructionParser(RuntimeTypeSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtension()
|
public void SimpleExtension()
|
||||||
{
|
{
|
||||||
var input = new List<ProtoInstruction>
|
var input = new List<ProtoInstruction>
|
||||||
|
@ -40,10 +39,10 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionWithOption()
|
public void ExtensionWithOption()
|
||||||
{
|
{
|
||||||
var input = new List<ProtoInstruction>
|
var input = new List<ProtoInstruction>
|
||||||
|
@ -69,7 +68,7 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Parsers.Parser;
|
using OmniXaml.Parsers.Parser;
|
||||||
using Resources;
|
using Resources;
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ParsingTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class ParsingTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly IInstructionParser sut;
|
private readonly IInstructionParser sut;
|
||||||
|
@ -29,7 +27,7 @@
|
||||||
return new InstructionParser(RuntimeTypeSource);
|
return new InstructionParser(RuntimeTypeSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NamespaceDeclarationOnly()
|
public void NamespaceDeclarationOnly()
|
||||||
{
|
{
|
||||||
var input = new List<ProtoInstruction>
|
var input = new List<ProtoInstruction>
|
||||||
|
@ -45,10 +43,10 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SingleInstanceCollapsed()
|
public void SingleInstanceCollapsed()
|
||||||
{
|
{
|
||||||
var input = protoResources.SingleCollapsed;
|
var input = protoResources.SingleCollapsed;
|
||||||
|
@ -57,10 +55,10 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SingleOpenAndClose()
|
public void SingleOpenAndClose()
|
||||||
{
|
{
|
||||||
var input = protoResources.SingleOpenAndClose;
|
var input = protoResources.SingleOpenAndClose;
|
||||||
|
@ -69,72 +67,72 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void EmptyElementWithStringProperty()
|
public void EmptyElementWithStringProperty()
|
||||||
{
|
{
|
||||||
var input = protoResources.EmptyElementWithStringProperty;
|
var input = protoResources.EmptyElementWithStringProperty;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.ObjectWithMember.ToList(), actualNodes.ToList());
|
Assert.Equal(source.ObjectWithMember.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void EmptyElementWithTwoStringProperties()
|
public void EmptyElementWithTwoStringProperties()
|
||||||
{
|
{
|
||||||
var input = protoResources.EmptyElementWithTwoStringProperties;
|
var input = protoResources.EmptyElementWithTwoStringProperties;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.ObjectWithTwoMembers.ToList(), actualNodes.ToList());
|
Assert.Equal(source.ObjectWithTwoMembers.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ElementWith2NsDeclarations()
|
public void ElementWith2NsDeclarations()
|
||||||
{
|
{
|
||||||
var input = protoResources.ElementWith2NsDeclarations2;
|
var input = protoResources.ElementWith2NsDeclarations2;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.ElementWithTwoDeclarations.ToList(), actualNodes.ToList());
|
Assert.Equal(source.ElementWithTwoDeclarations.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ElementWithNestedChild()
|
public void ElementWithNestedChild()
|
||||||
{
|
{
|
||||||
var input = protoResources.ElementWithNestedChild;
|
var input = protoResources.ElementWithNestedChild;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.NestedChild.ToList(), actualNodes.ToList());
|
Assert.Equal(source.NestedChild.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ComplexNesting()
|
public void ComplexNesting()
|
||||||
{
|
{
|
||||||
var input = protoResources.ComplexNesting;
|
var input = protoResources.ComplexNesting;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.ComplexNesting.ToList(), actualNodes);
|
Assert.Equal(source.ComplexNesting.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ChildCollection()
|
public void ChildCollection()
|
||||||
{
|
{
|
||||||
var input = protoResources.CollectionWithMoreThanOneItem;
|
var input = protoResources.CollectionWithMoreThanOneItem;
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
|
Assert.Equal(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NestedChildWithContentProperty()
|
public void NestedChildWithContentProperty()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -143,50 +141,50 @@
|
||||||
var actual = sut.Parse(input).ToList();
|
var actual = sut.Parse(input).ToList();
|
||||||
|
|
||||||
var expected = source.NestedChildWithContentProperty.ToList();
|
var expected = source.NestedChildWithContentProperty.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NestedCollectionWithContentProperty()
|
public void NestedCollectionWithContentProperty()
|
||||||
{
|
{
|
||||||
var input = protoResources.NestedCollectionWithContentProperty;
|
var input = protoResources.NestedCollectionWithContentProperty;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
|
Assert.Equal(source.CollectionWithMoreThanOneItem.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollectionsContentPropertyNesting()
|
public void CollectionsContentPropertyNesting()
|
||||||
{
|
{
|
||||||
var input = protoResources.ContentPropertyNesting;
|
var input = protoResources.ContentPropertyNesting;
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
var expectedInstructions = source.ContentPropertyNesting;
|
var expectedInstructions = source.ContentPropertyNesting;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes);
|
Assert.Equal(expectedInstructions.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TwoNestedProperties()
|
public void TwoNestedProperties()
|
||||||
{
|
{
|
||||||
var input = protoResources.TwoNestedProperties;
|
var input = protoResources.TwoNestedProperties;
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
var expectedInstructions = source.TwoNestedProperties;
|
var expectedInstructions = source.TwoNestedProperties;
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes);
|
Assert.Equal(expectedInstructions.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TwoNestedPropertiesUsingContentProperty()
|
public void TwoNestedPropertiesUsingContentProperty()
|
||||||
{
|
{
|
||||||
var input = protoResources.TwoNestedPropertiesUsingContentProperty;
|
var input = protoResources.TwoNestedPropertiesUsingContentProperty;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.TwoNestedPropertiesUsingContentProperty.ToList(), actualNodes);
|
Assert.Equal(source.TwoNestedPropertiesUsingContentProperty.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem()
|
public void TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -194,46 +192,46 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem.ToList(), actualNodes);
|
Assert.Equal(source.TwoNestedPropertiesOneOfThemUsesContentPropertyWithSingleItem.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MixedPropertiesWithContentPropertyAfter()
|
public void MixedPropertiesWithContentPropertyAfter()
|
||||||
{
|
{
|
||||||
CollectionAssert.AreEqual(
|
Assert.Equal(
|
||||||
source.MixedPropertiesWithContentPropertyAfter.ToList(),
|
source.MixedPropertiesWithContentPropertyAfter.ToList(),
|
||||||
sut.Parse(protoResources.MixedPropertiesWithContentPropertyAfter).ToList());
|
sut.Parse(protoResources.MixedPropertiesWithContentPropertyAfter).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollectionWithMixedEmptyAndNotEmptyNestedElements()
|
public void CollectionWithMixedEmptyAndNotEmptyNestedElements()
|
||||||
{
|
{
|
||||||
CollectionAssert.AreEqual(
|
Assert.Equal(
|
||||||
source.CollectionWithMixedEmptyAndNotEmptyNestedElements.ToList(),
|
source.CollectionWithMixedEmptyAndNotEmptyNestedElements.ToList(),
|
||||||
sut.Parse(protoResources.CollectionWithMixedEmptyAndNotEmptyNestedElements).ToList());
|
sut.Parse(protoResources.CollectionWithMixedEmptyAndNotEmptyNestedElements).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MixedPropertiesWithContentPropertyBefore()
|
public void MixedPropertiesWithContentPropertyBefore()
|
||||||
{
|
{
|
||||||
var input = protoResources.MixedPropertiesWithContentPropertyBefore;
|
var input = protoResources.MixedPropertiesWithContentPropertyBefore;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.MixedPropertiesWithContentPropertyBefore.ToList(), actualNodes);
|
Assert.Equal(source.MixedPropertiesWithContentPropertyBefore.ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ImplicitContentPropertyWithImplicityCollection()
|
public void ImplicitContentPropertyWithImplicityCollection()
|
||||||
{
|
{
|
||||||
var input = protoResources.ImplicitContentPropertyWithImplicityCollection;
|
var input = protoResources.ImplicitContentPropertyWithImplicityCollection;
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input).ToList();
|
var actualNodes = sut.Parse(input).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(source.CreateExpectedNodesForImplicitContentPropertyWithImplicityCollection().ToList(), actualNodes);
|
Assert.Equal(source.CreateExpectedNodesForImplicitContentPropertyWithImplicityCollection().ToList(), actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ClrNamespace()
|
public void ClrNamespace()
|
||||||
{
|
{
|
||||||
var type = typeof(DummyClass);
|
var type = typeof(DummyClass);
|
||||||
|
@ -254,10 +252,10 @@
|
||||||
|
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExpandedStringProperty()
|
public void ExpandedStringProperty()
|
||||||
{
|
{
|
||||||
var input = protoResources.ExpandedStringProperty;
|
var input = protoResources.ExpandedStringProperty;
|
||||||
|
@ -267,18 +265,18 @@
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
var xamlNodes = actualNodes.ToList();
|
var xamlNodes = actualNodes.ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), xamlNodes);
|
Assert.Equal(expectedInstructions.ToList(), xamlNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TextInInnerContent()
|
public void TextInInnerContent()
|
||||||
{
|
{
|
||||||
var actual = sut.Parse(protoResources.ContentPropertyInInnerContent).ToList();
|
var actual = sut.Parse(protoResources.ContentPropertyInInnerContent).ToList();
|
||||||
var expected = source.TextBlockWithText.ToList();
|
var expected = source.TextBlockWithText.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void String()
|
public void String()
|
||||||
{
|
{
|
||||||
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
|
var sysNs = new NamespaceDeclaration("clr-namespace:System;assembly=mscorlib", "sys");
|
||||||
|
@ -289,40 +287,40 @@
|
||||||
var actualNodes = sut.Parse(input);
|
var actualNodes = sut.Parse(input);
|
||||||
var xamlNodes = actualNodes.ToList();
|
var xamlNodes = actualNodes.ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), xamlNodes);
|
Assert.Equal(expectedInstructions.ToList(), xamlNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void PureCollection()
|
public void PureCollection()
|
||||||
{
|
{
|
||||||
var actual = sut.Parse(protoResources.PureCollection).ToList();
|
var actual = sut.Parse(protoResources.PureCollection).ToList();
|
||||||
var expected = source.PureCollection.ToList();
|
var expected = source.PureCollection.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void MixedCollection()
|
public void MixedCollection()
|
||||||
{
|
{
|
||||||
var actual = sut.Parse(protoResources.MixedCollection).ToList();
|
var actual = sut.Parse(protoResources.MixedCollection).ToList();
|
||||||
var expected = source.MixedCollection.ToList();
|
var expected = source.MixedCollection.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ChildInDeeperNameScopeWithNamesInTwoLevels()
|
public void ChildInDeeperNameScopeWithNamesInTwoLevels()
|
||||||
{
|
{
|
||||||
var actual = sut.Parse(protoResources.ChildInDeeperNameScopeWithNamesInTwoLevels).ToList();
|
var actual = sut.Parse(protoResources.ChildInDeeperNameScopeWithNamesInTwoLevels).ToList();
|
||||||
var expected = source.ListBoxWithItemAndTextBlockWithNames.ToList();
|
var expected = source.ListBoxWithItemAndTextBlockWithNames.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DirectContentForOneToMany()
|
public void DirectContentForOneToMany()
|
||||||
{
|
{
|
||||||
var expected = source.DirectContentForOneToMany.ToList();
|
var expected = source.DirectContentForOneToMany.ToList();
|
||||||
var actual = sut.Parse(protoResources.DirectContentForOneToMany).ToList();
|
var actual = sut.Parse(protoResources.DirectContentForOneToMany).ToList();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -332,7 +330,7 @@
|
||||||
var expected = source.ImplicitCollection.ToList();
|
var expected = source.ImplicitCollection.ToList();
|
||||||
var actual = sut.Parse(protoResources.ImplicitCollection).ToList();
|
var actual = sut.Parse(protoResources.ImplicitCollection).ToList();
|
||||||
|
|
||||||
Xunit.Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -341,7 +339,7 @@
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
var expected = source.ExplicitCollection.ToList();
|
var expected = source.ExplicitCollection.ToList();
|
||||||
var actual = sut.Parse(protoResources.ExplicitCollection).ToList();
|
var actual = sut.Parse(protoResources.ExplicitCollection).ToList();
|
||||||
Xunit.Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -351,7 +349,7 @@
|
||||||
var expected = source.AttachableMemberThatIsCollection.ToList();
|
var expected = source.AttachableMemberThatIsCollection.ToList();
|
||||||
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollection).ToList();
|
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollection).ToList();
|
||||||
|
|
||||||
Xunit.Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -361,15 +359,15 @@
|
||||||
var expected = source.AttachableMemberThatIsCollectionImplicit.ToList();
|
var expected = source.AttachableMemberThatIsCollectionImplicit.ToList();
|
||||||
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollectionImplicit).ToList();
|
var actual = sut.Parse(protoResources.AttachableMemberThatIsCollectionImplicit).ToList();
|
||||||
|
|
||||||
Xunit.Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExpandedAttachablePropertyAndItemBelow()
|
public void ExpandedAttachablePropertyAndItemBelow()
|
||||||
{
|
{
|
||||||
var actual = sut.Parse(protoResources.ExpandedAttachablePropertyAndItemBelow).ToList();
|
var actual = sut.Parse(protoResources.ExpandedAttachablePropertyAndItemBelow).ToList();
|
||||||
var expected = source.ExpandedAttachablePropertyAndItemBelow.ToList();
|
var expected = source.ExpandedAttachablePropertyAndItemBelow.ToList();
|
||||||
CollectionAssert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,12 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Parsers.Parser;
|
using OmniXaml.Parsers.Parser;
|
||||||
using OmniXaml.Parsers.ProtoParser;
|
using OmniXaml.Parsers.ProtoParser;
|
||||||
using Resources;
|
using Resources;
|
||||||
using Xaml.Tests.Resources;
|
using Xaml.Tests.Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class FromXamlToInstructions : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class FromXamlToInstructions : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly InstructionResources source;
|
private readonly InstructionResources source;
|
||||||
|
@ -21,164 +20,163 @@
|
||||||
source = new InstructionResources(this);
|
source = new InstructionResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof (XmlException))]
|
|
||||||
public void EmptyString()
|
public void EmptyString()
|
||||||
{
|
{
|
||||||
ExtractNodesFromPullParser(string.Empty);
|
Assert.Throws<XmlException>(() => ExtractNodesFromPullParser(string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SingleInstance()
|
public void SingleInstance()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.SingleInstance;
|
var expectedInstructions = source.SingleInstance;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.SingleInstance);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.SingleInstance);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void RootNamespace()
|
public void RootNamespace()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.SingleInstance;
|
var expectedInstructions = source.SingleInstance;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.RootNamespace);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.RootNamespace);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void InstanceWithStringPropertyAndNsDeclaration()
|
public void InstanceWithStringPropertyAndNsDeclaration()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.ObjectWithMember;
|
var expectedInstructions = source.ObjectWithMember;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.StringProperty);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.StringProperty);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void InstanceWithChild()
|
public void InstanceWithChild()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.InstanceWithChild;
|
var expectedInstructions = source.InstanceWithChild;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.InstanceWithChild);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.InstanceWithChild);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DifferentNamespaces()
|
public void DifferentNamespaces()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.DifferentNamespaces;
|
var expectedInstructions = source.DifferentNamespaces;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespaces);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespaces);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DifferentNamespacesAndMoreThanOneProperty()
|
public void DifferentNamespacesAndMoreThanOneProperty()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.DifferentNamespacesAndMoreThanOneProperty;
|
var expectedInstructions = source.DifferentNamespacesAndMoreThanOneProperty;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespacesAndMoreThanOneProperty);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.DifferentNamespacesAndMoreThanOneProperty);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ClassWithInnerCollection()
|
public void ClassWithInnerCollection()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.CollectionWithOneItem;
|
var expectedInstructions = source.CollectionWithOneItem;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.ClassWithInnerCollection);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.ClassWithInnerCollection);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollectionWithMoreThanOneItem()
|
public void CollectionWithMoreThanOneItem()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.CollectionWithMoreThanOneItem;
|
var expectedInstructions = source.CollectionWithMoreThanOneItem;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithMoreThanOneItem);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithMoreThanOneItem);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollapsedTagWithProperty()
|
public void CollapsedTagWithProperty()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.CollapsedTagWithProperty;
|
var expectedInstructions = source.CollapsedTagWithProperty;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.CollapsedTagWithProperty);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.CollapsedTagWithProperty);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void CollectionWithClosedItemAndProperty()
|
public void CollectionWithClosedItemAndProperty()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.CollectionWithOneItemAndAMember;
|
var expectedInstructions = source.CollectionWithOneItemAndAMember;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithClosedItemAndProperty);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.CollectionWithClosedItemAndProperty);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtension()
|
public void SimpleExtension()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.SimpleExtension;
|
var expectedInstructions = source.SimpleExtension;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtension);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtension);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtensionWithOneAssignment()
|
public void SimpleExtensionWithOneAssignment()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.SimpleExtensionWithOneAssignment;
|
var expectedInstructions = source.SimpleExtensionWithOneAssignment;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtensionWithOneAssignment);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.SimpleExtensionWithOneAssignment);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ContentPropertyForCollectionOneElement()
|
public void ContentPropertyForCollectionOneElement()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.ContentPropertyForCollectionOneElement;
|
var expectedInstructions = source.ContentPropertyForCollectionOneElement;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionOneElement);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionOneElement);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ContentPropertyForCollectionMoreThanOneElement()
|
public void ContentPropertyForCollectionMoreThanOneElement()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.ContentPropertyForCollectionMoreThanOneElement;
|
var expectedInstructions = source.ContentPropertyForCollectionMoreThanOneElement;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionMoreThanOneElement);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForCollectionMoreThanOneElement);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ContentPropertyForSingleProperty()
|
public void ContentPropertyForSingleProperty()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.ContentPropertyForSingleProperty;
|
var expectedInstructions = source.ContentPropertyForSingleProperty;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForSingleMember);
|
var actualNodes = ExtractNodesFromPullParser(Dummy.ContentPropertyForSingleMember);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions.ToList(), actualNodes.ToList());
|
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICollection<Instruction> ExtractNodesFromPullParser(string xml)
|
private ICollection<Instruction> ExtractNodesFromPullParser(string xml)
|
||||||
|
@ -192,14 +190,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void KeyDirective()
|
public void KeyDirective()
|
||||||
{
|
{
|
||||||
var expectedInstructions = source.KeyDirective2;
|
var expectedInstructions = source.KeyDirective2;
|
||||||
|
|
||||||
var actualNodes = ExtractNodesFromPullParser(Dummy.KeyDirective);
|
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 System.Linq;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Parsers.MarkupExtensions;
|
using OmniXaml.Parsers.MarkupExtensions;
|
||||||
using Resources;
|
using Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class MarkupExtensionNodeToXamlNodesConverterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class MarkupExtensionNodeToXamlNodesConverterTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NameOnly()
|
public void NameOnly()
|
||||||
{
|
{
|
||||||
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"));
|
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"));
|
||||||
|
@ -24,10 +23,10 @@
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NameAndAttribute()
|
public void NameAndAttribute()
|
||||||
{
|
{
|
||||||
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection {new PropertyOption("Property", new StringNode("Value"))});
|
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection {new PropertyOption("Property", new StringNode("Value"))});
|
||||||
|
@ -43,10 +42,10 @@
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NameAndTwoAttributes()
|
public void NameAndTwoAttributes()
|
||||||
{
|
{
|
||||||
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
|
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
|
||||||
|
@ -69,10 +68,10 @@
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void PositionalOption()
|
public void PositionalOption()
|
||||||
{
|
{
|
||||||
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
|
var tree = new MarkupExtensionNode(new IdentifierNode("DummyExtension"), new OptionsCollection
|
||||||
|
@ -91,10 +90,10 @@
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ComposedExtensionTemplateBindingWithConverter()
|
public void ComposedExtensionTemplateBindingWithConverter()
|
||||||
{
|
{
|
||||||
var tree = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
|
var tree = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
|
||||||
|
@ -117,7 +116,7 @@
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,91 +2,90 @@
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using OmniXaml.Parsers.MarkupExtensions;
|
using OmniXaml.Parsers.MarkupExtensions;
|
||||||
using Resources;
|
using Resources;
|
||||||
using Sprache;
|
using Sprache;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ParsingTests
|
public class ParsingTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtension()
|
public void SimpleExtension()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy}");
|
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()
|
public void PrefixedExtension()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.MarkupExtension.Parse("{x:Dummy}");
|
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()
|
public void ExtensionWithTwoPositionalOptions()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value1,Value2}");
|
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value1,Value2}");
|
||||||
var options = new OptionsCollection { new PositionalOption("Value1"), new PositionalOption("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()
|
public void ExtensionWithDottedPositionalOption()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Direct.Value}");
|
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Direct.Value}");
|
||||||
var options = new OptionsCollection { new PositionalOption("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()
|
public void DelimitedBy()
|
||||||
{
|
{
|
||||||
var identifier = from c in Parse.LetterOrDigit.Many() select new string(c.ToArray());
|
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 parser = from id in identifier.DelimitedBy(Parse.Char(',').Token()) select id;
|
||||||
var parsed = parser.Parse("SomeValue , AnotherValue");
|
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()
|
public void ExtensionWithPositionalAndAssignmentOptions()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value,Property='Some Value'}");
|
var actual = MarkupExtensionParser.MarkupExtension.Parse("{Dummy Value,Property='Some Value'}");
|
||||||
var options = new OptionsCollection { new PositionalOption("Value"), new PropertyOption("Property", new StringNode("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()
|
public void AssignmentOfDirectValue()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Assignment.Parse("Property=SomeValue");
|
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()
|
public void AssignmentOfDottedDirectValue()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Assignment.Parse("Property=Some.Value");
|
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()
|
public void AssignmentOfDirectValueWithColon()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Assignment.Parse("Property=x:SomeValue");
|
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()
|
public void AssignmentOfQuotedValue()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Assignment.Parse("Property='value with spaces'");
|
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()
|
public void ParsePositionalAndPropertyOptions()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Options.Parse("value1,Property1=Value1,Property2='Some value'");
|
var actual = MarkupExtensionParser.Options.Parse("value1,Property1=Value1,Property2='Some value'");
|
||||||
|
@ -97,18 +96,18 @@
|
||||||
new PropertyOption("Property2", new StringNode("Some value"))
|
new PropertyOption("Property2", new StringNode("Some value"))
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.AreEqual(actual, expected);
|
Assert.Equal(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ParsePropertyWithExtension()
|
public void ParsePropertyWithExtension()
|
||||||
{
|
{
|
||||||
var actual = MarkupExtensionParser.Assignment.Parse("Value={Dummy}");
|
var actual = MarkupExtensionParser.Assignment.Parse("Value={Dummy}");
|
||||||
var markupExtensionNode = new MarkupExtensionNode(new IdentifierNode("DummyExtension"));
|
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()
|
public void ComposedExtensionTemplateBindingWithConverter()
|
||||||
{
|
{
|
||||||
var actual =
|
var actual =
|
||||||
|
@ -116,10 +115,10 @@
|
||||||
|
|
||||||
var expected = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
|
var expected = MarkupExtensionNodeResources.ComposedExtensionTemplateBindingWithConverter();
|
||||||
|
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ComposedExtension()
|
public void ComposedExtension()
|
||||||
{
|
{
|
||||||
var actual =
|
var actual =
|
||||||
|
@ -128,7 +127,7 @@
|
||||||
|
|
||||||
var expected = MarkupExtensionNodeResources.ComposedExtension();
|
var expected = MarkupExtensionNodeResources.ComposedExtension();
|
||||||
|
|
||||||
Assert.AreEqual(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
sut.Push(1);
|
sut.Push(1);
|
||||||
Xunit.Assert.Equal(1, sut.Current.Value);
|
Assert.Equal(1, sut.Current.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
using Classes.Templates;
|
using Classes.Templates;
|
||||||
using Classes.WpfLikeModel;
|
using Classes.WpfLikeModel;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using ObjectAssembler;
|
using ObjectAssembler;
|
||||||
using TypeConversion;
|
using TypeConversion;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class TemplateHostingObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class TemplateHostingObjectAssemblerTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleTest()
|
public void SimpleTest()
|
||||||
{
|
{
|
||||||
var input = new Collection<Instruction>
|
var input = new Collection<Instruction>
|
||||||
|
@ -44,14 +44,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var actualNodes = sut.NodeList;
|
var actualNodes = sut.NodeList;
|
||||||
var expectedInstructions = new Collection<Instruction>
|
var expectedInstructions = new List<Instruction>
|
||||||
{
|
{
|
||||||
X.StartObject<Grid>(),
|
X.StartObject<Grid>(),
|
||||||
X.EndObject(),
|
X.EndObject(),
|
||||||
};
|
}.AsReadOnly();
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expectedInstructions, actualNodes);
|
Assert.Equal(expectedInstructions, actualNodes);
|
||||||
Assert.IsNotNull(((Item) sut.Result).Template.Content);
|
Assert.NotNull(((Item) sut.Result).Template.Content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,11 +3,10 @@
|
||||||
using Builder;
|
using Builder;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Typing;
|
using Typing;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class TypeRepositoryTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class TypeRepositoryTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
private readonly Mock<INamespaceRegistry> nsRegistryMock;
|
private readonly Mock<INamespaceRegistry> nsRegistryMock;
|
||||||
|
@ -28,46 +27,41 @@
|
||||||
|
|
||||||
nsRegistryMock.Setup(registry => registry.GetNamespace("clr-namespace:DummyNamespace;Assembly=DummyAssembly"))
|
nsRegistryMock.Setup(registry => registry.GetNamespace("clr-namespace:DummyNamespace;Assembly=DummyAssembly"))
|
||||||
.Returns(new ClrNamespace(type.Assembly, type.Namespace));
|
.Returns(new ClrNamespace(type.Assembly, type.Namespace));
|
||||||
}
|
|
||||||
|
|
||||||
[TestInitialize]
|
|
||||||
public void Initialize()
|
|
||||||
{
|
|
||||||
sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
|
sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetWithFullAddressReturnsCorrectType()
|
public void GetWithFullAddressReturnsCorrectType()
|
||||||
{
|
{
|
||||||
var xamlType = sut.GetByFullAddress(new XamlTypeName("root", "DummyClass"));
|
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()
|
public void GetWithFullAddressOfClrNamespaceReturnsTheCorrectType()
|
||||||
{
|
{
|
||||||
var xamlType = sut.GetByFullAddress(new XamlTypeName("clr-namespace:DummyNamespace;Assembly=DummyAssembly", "DummyClass"));
|
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()
|
public void GetByQualifiedName_ForTypeInDefaultNamespace()
|
||||||
{
|
{
|
||||||
sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
|
sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy());
|
||||||
|
|
||||||
var xamlType = sut.GetByQualifiedName("DummyClass");
|
var xamlType = sut.GetByQualifiedName("DummyClass");
|
||||||
|
|
||||||
Assert.AreEqual(xamlType.UnderlyingType, typeof(DummyClass));
|
Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof(TypeNotFoundException))]
|
|
||||||
public void FullAddressOfUnknownThrowNotFound()
|
public void FullAddressOfUnknownThrowNotFound()
|
||||||
{
|
{
|
||||||
const string unreachableTypeName = "UnreachableType";
|
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);
|
return new TypeFeatureProvider(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DependsOnRegister()
|
public void DependsOnRegister()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
@ -87,10 +81,10 @@
|
||||||
TypeRepositoryMixin.RegisterMetadata(sut, expectedMetadata);
|
TypeRepositoryMixin.RegisterMetadata(sut, expectedMetadata);
|
||||||
|
|
||||||
var metadata = sut.GetMetadata<DummyClass>();
|
var metadata = sut.GetMetadata<DummyClass>();
|
||||||
Assert.AreEqual(expectedMetadata.AsNonGeneric(), metadata);
|
Assert.Equal(expectedMetadata.AsNonGeneric(), metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetMetadata()
|
public void GetMetadata()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
@ -100,10 +94,10 @@
|
||||||
|
|
||||||
var actual = sut.GetMetadata<DummyClass>();
|
var actual = sut.GetMetadata<DummyClass>();
|
||||||
|
|
||||||
Assert.AreEqual(expected.AsNonGeneric(), actual);
|
Assert.Equal(expected.AsNonGeneric(), actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GetMetadataOfSubClass_ReturnsPreviousParentMetadata()
|
public void GetMetadataOfSubClass_ReturnsPreviousParentMetadata()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
@ -112,10 +106,10 @@
|
||||||
sut.RegisterMetadata(expected);
|
sut.RegisterMetadata(expected);
|
||||||
var actual = sut.GetMetadata<DummyClass>();
|
var actual = sut.GetMetadata<DummyClass>();
|
||||||
|
|
||||||
Assert.AreEqual(expected.AsNonGeneric(), actual);
|
Assert.Equal(expected.AsNonGeneric(), actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GivenMetadataDefinitionsForBothClassAndSubclass_GetMetadataOfSubClass_ReturnsItsOwnMetadata()
|
public void GivenMetadataDefinitionsForBothClassAndSubclass_GetMetadataOfSubClass_ReturnsItsOwnMetadata()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
@ -125,10 +119,10 @@
|
||||||
sut.RegisterMetadata(new GenericMetadata<DummyObject>());
|
sut.RegisterMetadata(new GenericMetadata<DummyObject>());
|
||||||
var actual = sut.GetMetadata<DummyClass>();
|
var actual = sut.GetMetadata<DummyClass>();
|
||||||
|
|
||||||
Assert.AreEqual(expected.AsNonGeneric(), actual);
|
Assert.Equal(expected.AsNonGeneric(), actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void GivenMetadataDefinitionsForParentAndGrandParent_GetMetadataOfChild_ReturnsParentMetadata()
|
public void GivenMetadataDefinitionsForParentAndGrandParent_GetMetadataOfChild_ReturnsParentMetadata()
|
||||||
{
|
{
|
||||||
var sut = CreateSut();
|
var sut = CreateSut();
|
||||||
|
@ -139,7 +133,7 @@
|
||||||
|
|
||||||
var actual = sut.GetMetadata<DummyChild>();
|
var actual = sut.GetMetadata<DummyChild>();
|
||||||
|
|
||||||
Assert.AreEqual(expected.AsNonGeneric(), actual);
|
Assert.Equal(expected.AsNonGeneric(), actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Visualization;
|
using Visualization;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class VisualizationTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
public class VisualizationTests : GivenARuntimeTypeSourceWithNodeBuildersNetCore
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ConvertToTags()
|
public void ConvertToTags()
|
||||||
{
|
{
|
||||||
var col = new Collection<Instruction>()
|
var col = new Collection<Instruction>()
|
||||||
|
@ -26,7 +25,7 @@
|
||||||
var result = NodeVisualizer.ToTags(col);
|
var result = NodeVisualizer.ToTags(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ConvertToNodes()
|
public void ConvertToNodes()
|
||||||
{
|
{
|
||||||
var col = new Collection<Instruction>()
|
var col = new Collection<Instruction>()
|
||||||
|
|
|
@ -1,68 +1,67 @@
|
||||||
namespace OmniXaml.Tests.XamlXmlLoaderTests
|
namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
{
|
{
|
||||||
using Classes;
|
using Classes;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using XamlResources = Xaml.Tests.Resources.Dummy;
|
using XamlResources = Xaml.Tests.Resources.Dummy;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class MarkupExtensionsTests : GivenAXmlLoader
|
public class MarkupExtensionsTests : GivenAXmlLoader
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtension()
|
public void SimpleExtension()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(XamlResources.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Text From Markup Extension", dummyClass.SampleProperty);
|
Assert.Equal("Text From Markup Extension", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleExtensionWithPropertyAssignment()
|
public void SimpleExtensionWithPropertyAssignment()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(XamlResources.SimpleExtensionWithOneAssignment);
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("SomeValue", dummyClass.SampleProperty);
|
Assert.Equal("SomeValue", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExtensionThatRetrievesInteger()
|
public void ExtensionThatRetrievesInteger()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString("<DummyClass xmlns=\"root\" Number=\"{Int Number=123}\"/>");
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual(123, dummyClass.Number);
|
Assert.Equal(123, dummyClass.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void QuotedValue()
|
public void QuotedValue()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"{Dummy Property=\'Some Value\'}\"/>");
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Some Value", dummyClass.SampleProperty);
|
Assert.Equal("Some Value", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void TwoQuotedValues()
|
public void TwoQuotedValues()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var actualInstance = Loader.FromString(XamlResources.MarkupExtensionTwoQuotedValues);
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Some Value", dummyClass.SampleProperty);
|
Assert.Equal("Some Value", dummyClass.SampleProperty);
|
||||||
Assert.AreEqual("Another Value", dummyClass.AnotherProperty);
|
Assert.Equal("Another Value", dummyClass.AnotherProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
namespace OmniXaml.Tests.XamlXmlLoaderTests
|
namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
{
|
{
|
||||||
using Classes;
|
using Classes;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Xaml.Tests.Resources;
|
using Xaml.Tests.Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class NameScopeTests : GivenAXmlLoader
|
public class NameScopeTests : GivenAXmlLoader
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void RegisterOneChildInNameScope()
|
public void RegisterOneChildInNameScope()
|
||||||
{
|
{
|
||||||
RuntimeTypeSource.ClearNamescopes();
|
RuntimeTypeSource.ClearNamescopes();
|
||||||
|
@ -15,10 +14,10 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
|
|
||||||
var actualInstance = Loader.FromString(Dummy.ChildInNameScope);
|
var actualInstance = Loader.FromString(Dummy.ChildInNameScope);
|
||||||
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
|
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
|
||||||
Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
|
Assert.IsType(typeof(ChildClass), childInScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void RegisterOneChildInNameScopeWithoutDirective()
|
public void RegisterOneChildInNameScopeWithoutDirective()
|
||||||
{
|
{
|
||||||
RuntimeTypeSource.ClearNamescopes();
|
RuntimeTypeSource.ClearNamescopes();
|
||||||
|
@ -26,7 +25,7 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
|
|
||||||
var actualInstance = Loader.FromString(Dummy.ChildInNamescopeNoNameDirective);
|
var actualInstance = Loader.FromString(Dummy.ChildInNamescopeNoNameDirective);
|
||||||
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
|
var childInScope = ((DummyObject)actualInstance).Find("MyObject");
|
||||||
Assert.IsInstanceOfType(childInScope, typeof(ChildClass));
|
Assert.IsType(typeof(ChildClass), childInScope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,214 +6,208 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Classes;
|
using Classes;
|
||||||
using Classes.WpfLikeModel;
|
using Classes.WpfLikeModel;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Xaml.Tests.Resources;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
|
using Xaml.Tests.Resources;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class ParsingTests : GivenAXmlLoader
|
public class ParsingTests : GivenAXmlLoader
|
||||||
{
|
{
|
||||||
private readonly Type expectedType = typeof (DummyClass);
|
private readonly Type expectedType = typeof (DummyClass);
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof (LoadException))]
|
|
||||||
public void EmptyStreamThrows()
|
public void EmptyStreamThrows()
|
||||||
{
|
{
|
||||||
Loader.FromString(Dummy.Empty);
|
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof (LoadException))]
|
|
||||||
public void UnknownElementThrows()
|
public void UnknownElementThrows()
|
||||||
{
|
{
|
||||||
Loader.FromString(Dummy.UnknownType);
|
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.UnknownType));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
[ExpectedException(typeof (LoadException))]
|
|
||||||
public void BadFormatThrowsXamlReaderException()
|
public void BadFormatThrowsXamlReaderException()
|
||||||
{
|
{
|
||||||
Loader.FromString(Dummy.BadFormat);
|
Assert.Throws<LoadException>(() => Loader.FromString(Dummy.BadFormat));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NoPrefixMapsToNamespaceAndReturnsTheCorrectInstance()
|
public void NoPrefixMapsToNamespaceAndReturnsTheCorrectInstance()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.RootNamespace);
|
var actual = Loader.FromString(Dummy.RootNamespace);
|
||||||
Assert.IsInstanceOfType(actual, expectedType);
|
Assert.IsType(expectedType, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void SimpleXamlWithCollapsedTagsShouldReadLikeExplicitEndingTag()
|
public void SimpleXamlWithCollapsedTagsShouldReadLikeExplicitEndingTag()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.CollapsedTag);
|
var actual = Loader.FromString(Dummy.CollapsedTag);
|
||||||
Assert.IsInstanceOfType(actual, expectedType);
|
Assert.IsType(expectedType, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DifferentNamespacesShouldReturnCorrectInstances()
|
public void DifferentNamespacesShouldReturnCorrectInstances()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.DifferentNamespaces);
|
var actual = Loader.FromString(Dummy.DifferentNamespaces);
|
||||||
Assert.IsInstanceOfType(actual, expectedType);
|
Assert.IsType(expectedType, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ReadInstanceWithChild()
|
public void ReadInstanceWithChild()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.InstanceWithChild);
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Debug.Assert(dummyClass != null, "dummyClass != null");
|
Debug.Assert(dummyClass != null, "dummyClass != null");
|
||||||
Assert.IsInstanceOfType(dummyClass.Child, typeof (ChildClass));
|
Assert.IsType(typeof (ChildClass), dummyClass.Child);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ReadInstanceWithThreeLevelsOfNesting()
|
public void ReadInstanceWithThreeLevelsOfNesting()
|
||||||
{
|
{
|
||||||
var root = Loader.FromString(Dummy.ThreeLevelsOfNesting);
|
var root = Loader.FromString(Dummy.ThreeLevelsOfNesting);
|
||||||
|
|
||||||
var dummy = root as DummyClass;
|
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");
|
Debug.Assert(dummy != null, "dummy != null");
|
||||||
var level2Instance = dummy.Child;
|
var level2Instance = dummy.Child;
|
||||||
Assert.IsNotNull(level2Instance);
|
Assert.NotNull(level2Instance);
|
||||||
|
|
||||||
var level3Instance = level2Instance.Child;
|
var level3Instance = level2Instance.Child;
|
||||||
Assert.IsNotNull(level3Instance);
|
Assert.NotNull(level3Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void KeyDirective()
|
public void KeyDirective()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.KeyDirective);
|
var actual = Loader.FromString(Dummy.KeyDirective);
|
||||||
Assert.IsInstanceOfType(actual, typeof (DummyClass));
|
Assert.IsType(typeof (DummyClass), actual);
|
||||||
var dictionary = (IDictionary) ((DummyClass) actual).Resources;
|
var dictionary = (IDictionary) ((DummyClass) actual).Resources;
|
||||||
Assert.IsTrue(dictionary.Count > 0);
|
Assert.True(dictionary.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void String()
|
public void String()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.String);
|
var actual = Loader.FromString(Dummy.String);
|
||||||
Assert.IsInstanceOfType(actual, typeof (string));
|
Assert.IsType(typeof (string), actual);
|
||||||
Assert.AreEqual("Text", actual);
|
Assert.Equal("Text", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void StringAsProperty()
|
public void StringAsProperty()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.StringAsProperty);
|
var actual = Loader.FromString(Dummy.StringAsProperty);
|
||||||
Assert.IsInstanceOfType(actual, typeof (DummyClass));
|
Assert.IsType(typeof (DummyClass), actual);
|
||||||
Assert.AreEqual("Text", ((DummyClass) actual).SampleProperty);
|
Assert.Equal("Text", ((DummyClass) actual).SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void StringWithWhitespace()
|
public void StringWithWhitespace()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.StringWithWhitespace);
|
var actual = Loader.FromString(Dummy.StringWithWhitespace);
|
||||||
Assert.IsInstanceOfType(actual, typeof (string));
|
Assert.IsType(typeof (string), actual);
|
||||||
Assert.AreEqual("Text", actual);
|
Assert.Equal("Text", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void Int()
|
public void Int()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.Int);
|
var actual = Loader.FromString(Dummy.Int);
|
||||||
Assert.IsInstanceOfType(actual, typeof (int));
|
Assert.IsType(typeof (int), actual);
|
||||||
Assert.AreEqual(123, actual);
|
Assert.Equal(123, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void StringProperty()
|
public void StringProperty()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Property!", dummyClass.SampleProperty);
|
Assert.Equal("Property!", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExpandedStringProperty()
|
public void ExpandedStringProperty()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.InnerContent);
|
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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Property!", dummyClass.SampleProperty);
|
Assert.Equal("Property!", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void InnerContentIsContentProperty()
|
public void InnerContentIsContentProperty()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.ContentPropertyInInnerContent);
|
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;
|
var dummyClass = actualInstance as TextBlock;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Hi all!!", dummyClass.Text);
|
Assert.Equal("Hi all!!", dummyClass.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void NonStringProperty()
|
public void NonStringProperty()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass, "dummyClass != null");
|
Assert.NotNull(dummyClass); // dummyClass != null
|
||||||
Assert.AreEqual(1234, dummyClass.Number);
|
Assert.Equal(1234, dummyClass.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ChildCollection()
|
public void ChildCollection()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.IsNotNull(dummyClass.Items);
|
Assert.NotNull(dummyClass.Items);
|
||||||
Assert.AreEqual(3, dummyClass.Items.Count);
|
Assert.Equal(3, dummyClass.Items.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void AttachedProperty()
|
public void AttachedProperty()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual(Container.GetProperty(dummyClass), "Value");
|
Assert.Equal(Container.GetProperty(dummyClass), "Value");
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void Ignorable()
|
public void Ignorable()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.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;
|
var dummyClass = actualInstance as DummyClass;
|
||||||
Assert.IsNotNull(dummyClass);
|
Assert.NotNull(dummyClass);
|
||||||
Assert.AreEqual("Property!", dummyClass.SampleProperty);
|
Assert.Equal("Property!", dummyClass.SampleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void DirectiveInSpecialNamespaceThatIsNotX()
|
public void DirectiveInSpecialNamespaceThatIsNotX()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.KeyDirectiveNotInX);
|
var actual = Loader.FromString(Dummy.KeyDirectiveNotInX);
|
||||||
Assert.IsInstanceOfType(actual, typeof(DummyClass));
|
Assert.IsType(typeof(DummyClass), actual);
|
||||||
var dictionary = (IDictionary)((DummyClass)actual).Resources;
|
var dictionary = (IDictionary)((DummyClass)actual).Resources;
|
||||||
Assert.IsTrue(dictionary.Count > 0);
|
Assert.True(dictionary.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ExpandedAttachablePropertyAndItemBelow()
|
public void ExpandedAttachablePropertyAndItemBelow()
|
||||||
{
|
{
|
||||||
var loadedObject = Loader.FromString(Dummy.ExpandedAttachablePropertyAndItemBelow);
|
var loadedObject = Loader.FromString(Dummy.ExpandedAttachablePropertyAndItemBelow);
|
||||||
|
@ -222,15 +216,15 @@
|
||||||
|
|
||||||
var firstChild = items.First();
|
var firstChild = items.First();
|
||||||
var attachedProperty = Container.GetProperty(firstChild);
|
var attachedProperty = Container.GetProperty(firstChild);
|
||||||
Xunit.Assert.Equal(2, items.Count);
|
Assert.Equal(2, items.Count);
|
||||||
Xunit.Assert.Equal("Value", attachedProperty);
|
Assert.Equal("Value", attachedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PureCollection()
|
public void PureCollection()
|
||||||
{
|
{
|
||||||
var actualInstance = Loader.FromString(Dummy.PureCollection);
|
var actualInstance = Loader.FromString(Dummy.PureCollection);
|
||||||
Xunit.Assert.NotEmpty((IEnumerable) actualInstance);
|
Assert.NotEmpty((IEnumerable) actualInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -239,10 +233,10 @@
|
||||||
var instance = Loader.FromString(Dummy.AttachableMemberThatIsCollection);
|
var instance = Loader.FromString(Dummy.AttachableMemberThatIsCollection);
|
||||||
var col = Container.GetCollection(instance);
|
var col = Container.GetCollection(instance);
|
||||||
|
|
||||||
Xunit.Assert.NotEmpty(col);
|
Assert.NotEmpty(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void ChildInDeeperNameScopeWithNamesInTwoLevels_HaveCorrectNames()
|
public void ChildInDeeperNameScopeWithNamesInTwoLevels_HaveCorrectNames()
|
||||||
{
|
{
|
||||||
var actual = Loader.FromString(Dummy.ChildInDeeperNameScopeWithNamesInTwoLevels);
|
var actual = Loader.FromString(Dummy.ChildInDeeperNameScopeWithNamesInTwoLevels);
|
||||||
|
@ -252,9 +246,9 @@
|
||||||
var lvi = (ListBoxItem)lb.Items.First();
|
var lvi = (ListBoxItem)lb.Items.First();
|
||||||
var tb = (TextBlock)lvi.Content;
|
var tb = (TextBlock)lvi.Content;
|
||||||
|
|
||||||
Assert.AreEqual("MyListBox", lb.Name);
|
Assert.Equal("MyListBox", lb.Name);
|
||||||
Assert.AreEqual("MyListBoxItem", lvi.Name);
|
Assert.Equal("MyListBoxItem", lvi.Name);
|
||||||
Assert.AreEqual("MyTextBlock", tb.Name);
|
Assert.Equal("MyTextBlock", tb.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
{
|
{
|
||||||
using Classes;
|
using Classes;
|
||||||
using Common.DotNetFx;
|
using Common.DotNetFx;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
public abstract class SpecialTests : GivenARuntimeTypeSourceNetCore
|
public abstract class SpecialTests : GivenARuntimeTypeSourceNetCore
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[Fact]
|
||||||
public void LoadWithRootInstance()
|
public void LoadWithRootInstance()
|
||||||
{
|
{
|
||||||
var dummy = new DummyClass
|
var dummy = new DummyClass
|
||||||
|
@ -19,9 +19,9 @@ namespace OmniXaml.Tests.XamlXmlLoaderTests
|
||||||
|
|
||||||
var actual = loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);
|
var actual = loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);
|
||||||
|
|
||||||
Assert.IsInstanceOfType(actual, dummy.GetType());
|
Assert.IsType(dummy.GetType(), actual);
|
||||||
Assert.AreEqual("Value", ((DummyClass)actual).SampleProperty);
|
Assert.Equal("Value", ((DummyClass)actual).SampleProperty);
|
||||||
Assert.AreEqual("Other value", ((DummyClass)actual).AnotherProperty);
|
Assert.Equal("Other value", ((DummyClass)actual).AnotherProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,11 +2,11 @@
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
|
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
|
||||||
<package id="Sprache.SuperJMN" version="2.0.0.50" 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.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.extensibility.core" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.extensibility.execution" version="2.2.0-beta1-build3239" targetFramework="net45" />
|
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="2.2.0-beta1-build1144" targetFramework="net45" developmentDependency="true" />
|
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -3,92 +3,91 @@
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
using Resources = Xaml.Tests.Resources.Wpf;
|
using Resources = Xaml.Tests.Resources.Wpf;
|
||||||
|
|
||||||
[TestClass]
|
|
||||||
public class LoadingTests : GivenAXamlXmlLoader
|
public class LoadingTests : GivenAXamlXmlLoader
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void Window()
|
public void Window()
|
||||||
{
|
{
|
||||||
var windowType = typeof(Window);
|
var windowType = typeof(Window);
|
||||||
|
|
||||||
var actualInstance = LoadXaml(Resources.Window);
|
var actualInstance = LoadXaml(Resources.Window);
|
||||||
Assert.IsInstanceOfType(actualInstance, windowType);
|
Assert.IsType(windowType, actualInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void WindowWithContent()
|
public void WindowWithContent()
|
||||||
{
|
{
|
||||||
var windowType = typeof(Window);
|
var windowType = typeof(Window);
|
||||||
var textBlockType = typeof(TextBlock);
|
var textBlockType = typeof(TextBlock);
|
||||||
|
|
||||||
var actualInstance = LoadXaml(Resources.WindowWithContent);
|
var actualInstance = LoadXaml(Resources.WindowWithContent);
|
||||||
Assert.IsInstanceOfType(actualInstance, windowType);
|
Assert.IsType(windowType, actualInstance);
|
||||||
var window = (Window)actualInstance;
|
var window = (Window)actualInstance;
|
||||||
Assert.IsInstanceOfType(window.Content, textBlockType);
|
Assert.IsType(textBlockType, window.Content);
|
||||||
var textBlock = (TextBlock)window.Content;
|
var textBlock = (TextBlock)window.Content;
|
||||||
Assert.AreEqual("Saludos cordiales!", textBlock.Text);
|
Assert.Equal("Saludos cordiales!", textBlock.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void DataTemplate()
|
public void DataTemplate()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.DataTemplate);
|
var visualTree = LoadXaml(Resources.DataTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void ShowCase()
|
public void ShowCase()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.ShowCase);
|
var visualTree = LoadXaml(Resources.ShowCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
|
|
||||||
public void MicroShowCase()
|
public void MicroShowCase()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.MicroShowCase);
|
var visualTree = LoadXaml(Resources.MicroShowCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
|
|
||||||
public void Stage1()
|
public void Stage1()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.Stage1);
|
var visualTree = LoadXaml(Resources.Stage1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StaFact]
|
||||||
public void Stage2()
|
public void Stage2()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.Stage2);
|
var visualTree = LoadXaml(Resources.Stage2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StaFact]
|
||||||
public void Stage3()
|
public void Stage3()
|
||||||
{
|
{
|
||||||
var visualTree = LoadXaml(Resources.Stage3);
|
var visualTree = LoadXaml(Resources.Stage3);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void ColorResource()
|
public void ColorResource()
|
||||||
{
|
{
|
||||||
var visualTree = (Window)LoadXaml(Resources.ColorResource);
|
var visualTree = (Window)LoadXaml(Resources.ColorResource);
|
||||||
var color = (Color)visualTree.FindResource("color");
|
var color = (Color)visualTree.FindResource("color");
|
||||||
Assert.AreEqual(0xff, color.A);
|
Assert.Equal(0xff, color.A);
|
||||||
Assert.AreEqual(0x80, color.R);
|
Assert.Equal(0x80, color.R);
|
||||||
Assert.AreEqual(0x80, color.G);
|
Assert.Equal(0x80, color.G);
|
||||||
Assert.AreEqual(0x80, color.B);
|
Assert.Equal(0x80, color.B);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[StaFact]
|
||||||
public void SolidColorBrushResource()
|
public void SolidColorBrushResource()
|
||||||
{
|
{
|
||||||
var visualTree = (Window)LoadXaml(Resources.SolidColorBrushResource);
|
var visualTree = (Window)LoadXaml(Resources.SolidColorBrushResource);
|
||||||
var brush = (SolidColorBrush)visualTree.FindResource("brush");
|
var brush = (SolidColorBrush)visualTree.FindResource("brush");
|
||||||
var color = brush.Color;
|
var color = brush.Color;
|
||||||
Assert.AreEqual(0xff, color.A);
|
Assert.Equal(0xff, color.A);
|
||||||
Assert.AreEqual(0x80, color.R);
|
Assert.Equal(0x80, color.R);
|
||||||
Assert.AreEqual(0x80, color.G);
|
Assert.Equal(0x80, color.G);
|
||||||
Assert.AreEqual(0x80, color.B);
|
Assert.Equal(0x80, color.B);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -43,6 +45,26 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="WindowsBase" />
|
<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>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
<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" />
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
</When>
|
||||||
<Otherwise>
|
<Otherwise />
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="GivenAXamlXmlLoader.cs" />
|
<Compile Include="GivenAXamlXmlLoader.cs" />
|
||||||
|
@ -66,6 +84,7 @@
|
||||||
<None Include="github_icon.png">
|
<None Include="github_icon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Glass\Glass.csproj">
|
<ProjectReference Include="..\..\Glass\Glass.csproj">
|
||||||
|
@ -105,6 +124,13 @@
|
||||||
</Choose>
|
</Choose>
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<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>
|
Загрузка…
Ссылка в новой задаче