Permalink
Browse files

Windows Phone 7.1 unit test support

  • Loading branch information...
1 parent b01245a commit 2a89386de6afed62e1ef6a6c5973e475bce4b04f @jkowalski committed Jun 10, 2011
Showing with 422 additions and 232 deletions.
  1. +11 −0 external/SilverlightUnitTestFramework/WP71/LICENSE.txt
  2. BIN external/SilverlightUnitTestFramework/WP71/Microsoft.Silverlight.Testing.dll
  3. BIN ...SilverlightUnitTestFramework/WP71/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
  4. +12 −0 src/NLog.proj
  5. +0 −8 src/NLog.wp71.sln
  6. +42 −22 tests/NLog.UnitTests/App.xaml.cs
  7. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.monodevelop.csproj
  8. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.netcf20.csproj
  9. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.netcf35.csproj
  10. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.netfx20.csproj
  11. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.netfx35.csproj
  12. +2 −7 tests/NLog.UnitTests/NLog.UnitTests.netfx40.csproj
  13. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.sl2.csproj
  14. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.sl3.csproj
  15. +0 −3 tests/NLog.UnitTests/NLog.UnitTests.sl4.csproj
  16. +9 −3 tests/NLog.UnitTests/NLog.UnitTests.wp7.csproj
  17. +11 −5 tests/NLog.UnitTests/NLog.UnitTests.wp71.csproj
  18. +10 −1 tests/NLog.UnitTests/ProjectFileInfo.xml
  19. +63 −20 tests/SilverlightConsoleRunner/ConsoleRunner.cs
  20. +0 −14 tests/SilverlightConsoleRunner/LogEventArgs.cs
  21. +53 −66 tests/SilverlightConsoleRunner/MicroHttpServer.cs
  22. +20 −7 tests/SilverlightConsoleRunner/Program.cs
  23. +0 −44 tests/SilverlightConsoleRunner/RunnerForm.cs
  24. +5 −2 tests/SilverlightConsoleRunner/SilverlightConsoleRunner.csproj
  25. +20 −0 tests/SilverlightConsoleRunner/SilverlightConsoleRunner.sln
  26. +0 −9 tests/SilverlightConsoleRunner/TestCompletedEventArgs.cs
  27. BIN tools/RunXap.dll
  28. +49 −0 tools/RunXap/Program.cs
  29. +36 −0 tools/RunXap/Properties/AssemblyInfo.cs
  30. +59 −0 tools/RunXap/RunXap.csproj
  31. +20 −0 tools/RunXap/RunXap.sln
@@ -0,0 +1,11 @@
+MSDN CODE GALLERY BINARY LICENSE
+
+You are free to install, use, copy and distribute any number of copies of the software, in object code form, provided that you retain:
+
+� all copyright, patent, trademark, and attribution notices that are present in the software,
+� this list of conditions, and
+� the following disclaimer in the documentation and/or other materials provided with the software.
+
+The software is licensed �as-is.� You bear the risk of using it. No express warranties, guarantees or conditions are provided. To the extent permitted under your local laws, the implied warranties of merchantability, fitness for a particular purpose and non-infringement are excluded.
+
+This license does not grant you any rights to use any other party�s name, logo, or trademarks. All rights not specifically granted herein are reserved.
View
@@ -271,6 +271,8 @@
<CallTarget Targets="SL2Test" Condition="'$(BuildSL2)'=='true'"/>
<CallTarget Targets="SL3Test" Condition="'$(BuildSL3)'=='true'"/>
<CallTarget Targets="SL4Test" Condition="'$(BuildSL4)'=='true'"/>
+ <CallTarget Targets="WP7Test" Condition="'$(BuildWP7)'=='true'"/>
+ <CallTarget Targets="WP71Test" Condition="'$(BuildWP71)'=='true'"/>
<CallTarget Targets="RunComApiTests" />
<Exec Command="..\tests\DeleteTestUsers.cmd" IgnoreExitCode="true" />
</Target>
@@ -334,6 +336,16 @@
WorkingDirectory="$(BaseOutputDirectory)\bin\$(Configuration)\Silverlight 4.0" IgnoreExitCode="true" />
</Target>
+ <Target Name="WP7Test" DependsOnTargets="BuildSLTestRunner">
+ <Exec Command='"$(SLTestRunner)" NLog.UnitTests.xap WP7 -guid 3cf9fab9-588c-49c8-8a45-ef071442304f -icon ApplicationIcon.png'
+ WorkingDirectory="$(BaseOutputDirectory)\bin\$(Configuration)\Silverlight for Windows Phone 7" IgnoreExitCode="true" />
+ </Target>
+
+ <Target Name="WP71Test" DependsOnTargets="BuildSLTestRunner">
+ <Exec Command='"$(SLTestRunner)" NLog.UnitTests.xap WP71 -guid 3cf9fab9-588c-49c8-8a45-ef071442304f -icon ApplicationIcon.png'
+ WorkingDirectory="$(BaseOutputDirectory)\bin\$(Configuration)\Silverlight for Windows Phone 7.1" IgnoreExitCode="true" />
+ </Target>
+
<Target Name="CheckinSuite">
<CallTarget Targets="SyncProjectItems" />
<CallTarget Targets="DeepClean" />
View
@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.UnitTests.wp71", "..\t
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleExtensions.wp71", "..\tests\SampleExtensions\SampleExtensions.wp71.csproj", "{8A0E38D3-1512-45B0-A360-218F7E98743D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLogWindowsPhoneApplication", "..\examples\NLogWindowsPhoneApplication\NLogWindowsPhoneApplication.csproj", "{17F2F126-6945-48A0-900F-A0859A3F1A0D}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -28,12 +26,6 @@ Global
{8A0E38D3-1512-45B0-A360-218F7E98743D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A0E38D3-1512-45B0-A360-218F7E98743D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A0E38D3-1512-45B0-A360-218F7E98743D}.Release|Any CPU.Build.0 = Release|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Release|Any CPU.Build.0 = Release|Any CPU
- {17F2F126-6945-48A0-900F-A0859A3F1A0D}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -46,9 +46,15 @@
namespace NLog.UnitTests
{
+ using System.Net;
+ using System.Text;
+ using System.Xml.Linq;
+ using Microsoft.Silverlight.Testing.UnitTesting.Metadata.VisualStudio;
+
public partial class App : Application
{
private VisualStudioLogProvider vsProvider = new VisualStudioLogProvider();
+ private static Uri baseUrl = new Uri("http://localhost:17788");
public App()
{
@@ -63,17 +69,41 @@ class MyLogProvider : LogProvider
{
public override void Process(LogMessage logMessage)
{
+ if (logMessage.HasDecorator(LogDecorator.TestStage))
+ {
+ var stage = (TestStage)logMessage[LogDecorator.TestStage];
+ if (stage == TestStage.Starting)
+ {
+ if (logMessage.HasDecorator(UnitTestLogDecorator.TestMethodMetadata))
+ {
+ var methodInfo = (TestMethod)logMessage[UnitTestLogDecorator.TestMethodMetadata];
+ var wc = new WebClient();
+ wc.UploadStringAsync(new Uri(baseUrl, "/TestMethodStarting?method=" + methodInfo.Name), "");
+ }
+ else if (logMessage.HasDecorator(UnitTestLogDecorator.TestClassMetadata))
+ {
+ var classInfo = (TestClass)logMessage[UnitTestLogDecorator.TestClassMetadata];
+ var wc = new WebClient();
+ wc.UploadStringAsync(new Uri(baseUrl, "/TestClassStarting?class=" + classInfo.Type.FullName), "");
+ }
+ }
+ }
+
if (logMessage.HasDecorator(UnitTestLogDecorator.ScenarioResult))
{
var result = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
-
- InvokeDomMethod("scenarioResult",
- result.Started.Ticks,
- result.Finished.Ticks,
- (result.TestClass != null) ? result.TestClass.Type.FullName : null,
- (result.TestMethod != null) ? result.TestMethod.Name : null,
- result.Result.ToString(),
- (result.Exception != null) ? result.Exception.ToString() : null);
+ var wc = new WebClient();
+ StringBuilder uri = new StringBuilder();
+ uri.Append("/TestMethodCompleted?result=" + result.Result);
+ if (result.TestClass != null)
+ {
+ uri.Append("&class=").Append(result.TestClass.Type.FullName);
+ }
+ if (result.TestMethod != null)
+ {
+ uri.Append("&method=").Append(result.TestMethod.Name);
+ }
+ wc.UploadStringAsync(new Uri(baseUrl, uri.ToString()), "");
}
}
}
@@ -106,7 +136,9 @@ void TestHarness_TestHarnessCompleted(object sender, TestHarnessCompletedEventAr
var harness = new MyHarness();
vsProvider.WriteLogFile(harness);
- InvokeDomMethod("testCompleted", harness.TrxContent);
+
+ var wc = new WebClient();
+ wc.UploadStringAsync(new Uri(baseUrl, "/Completed"), harness.TrxContent);
}
private void Application_Exit(object sender, EventArgs e)
@@ -115,6 +147,7 @@ private void Application_Exit(object sender, EventArgs e)
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
+ MessageBox.Show(e.ExceptionObject.ToString());
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
@@ -147,19 +180,6 @@ private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
}
}
-
- private static void InvokeDomMethod(string methodName, params object[] arguments)
- {
- try
- {
-#if !WINDOWS_PHONE
- HtmlPage.Window.Invoke(methodName, arguments);
-#endif
- }
- catch
- {
- }
- }
}
}
@@ -156,8 +156,6 @@
<Compile Include="Targets\Wrappers\WrapperTargetBaseTests.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -166,7 +164,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="NLogTests.snk" />
@@ -165,8 +165,6 @@
<None Include="NLogTests.snk" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -175,7 +173,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\NLog\NLog.netcf20.csproj">
@@ -160,8 +160,6 @@
<Compile Include="Targets\Wrappers\WrapperTargetBaseTests.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -170,7 +168,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="NLogTests.snk" />
@@ -160,8 +160,6 @@
<Compile Include="Targets\Wrappers\WrapperTargetBaseTests.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -170,7 +168,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="NLogTests.snk" />
@@ -162,8 +162,6 @@
<Compile Include="Targets\Wrappers\WrapperTargetBaseTests.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -172,7 +170,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="NLogTests.snk" />
@@ -9,10 +9,8 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
+ <ApplicationIcon></ApplicationIcon>
+ <AssemblyKeyContainerName></AssemblyKeyContainerName>
<AssemblyName>NLog.UnitTests</AssemblyName>
<AssemblyOriginatorKeyFile>NLogTests.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
@@ -161,8 +159,6 @@
<Compile Include="Targets\Wrappers\WrapperTargetBaseTests.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -171,7 +167,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="NLogTests.snk" />
@@ -208,8 +208,6 @@
<None Include="Properties\OutOfBrowserSettings.xml" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -218,7 +216,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\NLog\NLog.sl2.csproj">
@@ -196,8 +196,6 @@
<None Include="Properties\OutOfBrowserSettings.xml" />
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -206,7 +204,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\NLog\NLog.sl3.csproj">
@@ -190,8 +190,6 @@
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -200,7 +198,6 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<Content Include="ConfigFiles\included.nlog" />
@@ -182,8 +182,12 @@
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
+ <Content Include="ApplicationIcon.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Background.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -192,7 +196,9 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
+ <Content Include="SplashScreenImage.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<Content Include="ConfigFiles\included.nlog" />
@@ -60,11 +60,11 @@
<ItemGroup>
<Reference Include="Microsoft.Silverlight.Testing, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\external\SilverlightUnitTestFramework\WP7\Microsoft.Silverlight.Testing.dll</HintPath>
+ <HintPath>..\..\external\SilverlightUnitTestFramework\WP71\Microsoft.Silverlight.Testing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\external\SilverlightUnitTestFramework\WP7\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
+ <HintPath>..\..\external\SilverlightUnitTestFramework\WP71\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="mscorlib" />
@@ -182,8 +182,12 @@
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
- <Content Include="ApplicationIcon.png" />
- <Content Include="Background.png" />
+ <Content Include="ApplicationIcon.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Background.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="ConfigFiles\included.nlog" />
<Content Include="ConfigFiles\main.nlog" />
<Content Include="ConfigFiles\referencemissingfile.nlog" />
@@ -192,7 +196,9 @@
<Content Include="Properties\AppManifest.xml" />
<Content Include="Properties\OutOfBrowserSettings.xml" />
<Content Include="Properties\WMAppManifest.xml" />
- <Content Include="SplashScreenImage.jpg" />
+ <Content Include="SplashScreenImage.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<Content Include="ConfigFiles\included.nlog" />
Oops, something went wrong.

0 comments on commit 2a89386

Please sign in to comment.