Skip to content

Commit

Permalink
Fixed silverlight unittest runner problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayt committed Jul 25, 2012
1 parent 72e2537 commit 494cb48
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 21 deletions.
Expand Up @@ -17,6 +17,8 @@
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
Expand Down Expand Up @@ -156,6 +158,7 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Expand Up @@ -17,6 +17,8 @@
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
Expand Down Expand Up @@ -226,6 +228,7 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Expand Up @@ -12,6 +12,8 @@
<AssemblyName>UnitTestImpromptuInterface.Clay</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -91,6 +93,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Expand Up @@ -11,6 +11,8 @@
<AssemblyName>UnitTestImpromptuInterface.SelfRunner</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<StartupObject>UnitTestImpromptuInterface.Program</StartupObject>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -120,4 +122,5 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
Expand Up @@ -25,6 +25,8 @@
<IsWebBootstrapper>true</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -138,4 +140,5 @@
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.Targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
4 changes: 1 addition & 3 deletions Tests/UnitTestImpromptuInterface/ImpromptuDynamic.cs
Expand Up @@ -590,9 +590,7 @@ public void TestLateLibrarybind()

if (tBigIntType.IsAvailable)
{
#if SILVERLIGHT
Assert.Fail();
#endif

var one = tBigIntType.@new(1);
var two = tBigIntType.@new(2);

Expand Down
5 changes: 4 additions & 1 deletion Tests/UnitTestImpromptuInterface/TinyIoCTest.cs
@@ -1,14 +1,17 @@
using System;
using ImpromptuInterface.MVVM.TinyIoC;

using TinyIoC;

#if !SELFRUNNER
using NUnit.Framework;
#endif

using ImpromptuInterface.MVVM;
using Assert = NUnit.Framework.Assert;

#if SILVERLIGHT
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestImpromptuInterface.Silverlight
#else
namespace UnitTestImpromptuInterface
Expand Down Expand Up @@ -68,7 +71,7 @@ public void Get_Many()
}
}

[Test, ExpectedException(typeof(NotSupportedException), ExpectedMessage = "TinyIoC does not support this operation!")]
[Test, ExpectedException(typeof(NotSupportedException))]
public void Get_Many_Dynamic()
{
var tinyContainer = new TinyIoCContainer();
Expand Down
Expand Up @@ -25,6 +25,8 @@
<IsWebBootstrapper>true</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -159,4 +161,5 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
3 changes: 3 additions & 0 deletions Tests/UnitTestImpromptuInterface/UnityTest.cs
Expand Up @@ -5,13 +5,16 @@
using Microsoft.Practices.Unity;

#if !SELFRUNNER

using NUnit.Framework;
#endif

using ImpromptuInterface.MVVM;
using ImpromptuInterface.MVVM.Unity;
using Assert = NUnit.Framework.Assert;

#if SILVERLIGHT
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestImpromptuInterface.Silverlight
#else
namespace UnitTestImpromptuInterface
Expand Down
88 changes: 88 additions & 0 deletions Tests/UnitTestImpromputInterface.Silverlight/Support/Helper.cs
Expand Up @@ -9,6 +9,94 @@
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using NUnit.Framework;
using Assert = NUnit.Framework.Assert;
using MSTest =Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NUnit.Framework
{
public delegate void TestDelegate();


public class Assert
{
public static void Throws<T>(TestDelegate fun) where T:Exception
{
var run = false;
try
{
fun();
}
catch (Exception e)
{

run = e is T || e is MSTest.AssertFailedException && new AssertionException("Dummy") is T;
}

MSTest.Assert.IsTrue(run,"Did Not Catch " + typeof(T).Name);
}

public static void AreEqual(dynamic a, dynamic b)
{
MSTest.Assert.AreEqual(a,b);
}

public static void Fail()
{
MSTest.Assert.Fail();
}

public static void IsFalse(bool test)
{
MSTest.Assert.IsFalse(test);
}

public static void IsInstanceOf<T>(object obj)
{
MSTest.Assert.IsInstanceOfType(obj,typeof(T));
}

public static void IsNotNull(object obj)
{
MSTest.Assert.IsNotNull(obj);
}

public static void Less(dynamic a, dynamic b)
{
MSTest.Assert.IsTrue( a < b, String.Format("Expected {0} to be less than {1}",a,b));
}
}

public class AssertionException:MSTest.AssertFailedException
{
public AssertionException(string message) : base(message)
{
}

public AssertionException(string message, Exception inner) : base(message, inner)
{
}
}

public class TestFixtureSetUpAttribute : Attribute
{

}

public class SetUpAttribute : Attribute
{

}

public class TestFixtureAttribute:Attribute
{

}

public class TestAttribute : Attribute
{

}
}


namespace UnitTestImpromptuInterface
{
Expand Down
Expand Up @@ -40,6 +40,8 @@
<IsWebBootstrapper>true</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
Expand Down Expand Up @@ -72,37 +74,32 @@
<Reference Include="Castle.Core">
<HintPath>..\..\packages\Moq.4.0.10827\lib\Silverlight4\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\..\packages\CommonServiceLocator.1.0\lib\SL30\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Silverlight">
<HintPath>..\..\packages\Unity.2.1.505.0\lib\SL30\Microsoft.Practices.Unity.Silverlight.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Silverlight.Testing">
<HintPath>..\..\tools\Silverlight4-NUnit2.5.8-Apr2010\Microsoft.Silverlight.Testing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\tools\Silverlight4-NUnit2.5.8-Apr2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Silverlight.Testing, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Moq.Silverlight">
<HintPath>..\..\packages\Moq.4.0.10827\lib\Silverlight4\Moq.Silverlight.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="Ninject">
<HintPath>..\..\packages\Ninject.2.2.1.4\lib\sl4\Ninject.dll</HintPath>
</Reference>
<Reference Include="NUnit.Silverlight.Compatibility">
<HintPath>..\..\tools\Silverlight4-NUnit2.5.8-Apr2010\NUnit.Silverlight.Compatibility.dll</HintPath>
</Reference>
<Reference Include="NUnit.Silverlight.Framework">
<HintPath>..\..\tools\Silverlight4-NUnit2.5.8-Apr2010\NUnit.Silverlight.Framework.dll</HintPath>
<Reference Include="System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.ComponentModel.Composition.dll</HintPath>
</Reference>
<Reference Include="NUnit.Silverlight.Metadata">
<HintPath>..\..\tools\Silverlight4-NUnit2.5.8-Apr2010\NUnit.Silverlight.Metadata.dll</HintPath>
<Reference Include="System.Windows">
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Windows" />
<Reference Include="System.Core">
<Private>False</Private>
</Reference>
Expand All @@ -111,8 +108,12 @@
<Reference Include="System" />
<Reference Include="System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Xml.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\UnitTestImpromptuInterface\Basic.cs">
Expand Down Expand Up @@ -217,6 +218,7 @@
<Properties InternalTargetFrameworkVersion="SL2.0" />
</MonoDevelop>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Expand Up @@ -17,6 +17,8 @@
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
Expand Down Expand Up @@ -68,6 +70,7 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
3 changes: 3 additions & 0 deletions Tests/UnitTestSupportLibrary/UnitTestSupportLibrary.csproj
Expand Up @@ -12,6 +12,8 @@
<AssemblyName>UnitTestSupportLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\impromptuinterface\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -45,6 +47,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down

0 comments on commit 494cb48

Please sign in to comment.