Skip to content

Commit

Permalink
This commit has changes to remove usage of MEF - i'm not doing manual…
Browse files Browse the repository at this point in the history
…ly what MEF did for me. Also includes a fix to suppor the MSTesting framework's TestContext property
  • Loading branch information
staxmanade committed Sep 22, 2010
1 parent 4807dde commit 43708ae
Show file tree
Hide file tree
Showing 16 changed files with 369 additions and 343 deletions.
8 changes: 2 additions & 6 deletions default.ps1
Expand Up @@ -177,8 +177,6 @@ function StatLightReferences {
"$silverlight_libraries_client_assemblies\System.Xml.Serialization.dll",
".\lib\Silverlight\Microsoft\$microsoft_silverlight_testing_version_name\Microsoft.Silverlight.Testing.dll"
".\lib\Silverlight\Microsoft\$microsoft_silverlight_testing_version_name\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"
"$silverlight_libraries_client_assemblies\System.ComponentModel.Composition.dll"
"$silverlight_libraries_client_assemblies\System.ComponentModel.Composition.Initialization.dll"
"$clientHarnessBuildOutputDir\StatLight.Client.Harness.dll"
)
$references;
Expand All @@ -202,8 +200,6 @@ function StatLightIntegrationTestsReferences {
"$silverlight_libraries_client_assemblies\System.Xml.Serialization.dll",
".\lib\Silverlight\Microsoft\$microsoft_silverlight_testing_version_name\Microsoft.Silverlight.Testing.dll"
".\lib\Silverlight\Microsoft\$microsoft_silverlight_testing_version_name\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"
"$silverlight_libraries_client_assemblies\System.ComponentModel.Composition.dll"
"$silverlight_libraries_client_assemblies\System.ComponentModel.Composition.Initialization.dll"
"$clientHarnessBuildOutputDir\StatLight.Client.Harness.dll"
)

Expand Down Expand Up @@ -429,11 +425,11 @@ function Execute-MSTest-Version-Acceptance-Tests {

if($build_configuration -eq 'Debug')
{
Assert-statlight-xml-report-results -message "Execute-MSTest-Version-Acceptance-Tests" -resultsXmlTextFilePath $scriptFile -expectedPassedCount 5 -expectedFailedCount 3 -expectedIgnoredCount 1 -expectedSystemGeneratedfailedCount 1
Assert-statlight-xml-report-results -message "Execute-MSTest-Version-Acceptance-Tests" -resultsXmlTextFilePath $scriptFile -expectedPassedCount 6 -expectedFailedCount 3 -expectedIgnoredCount 1 -expectedSystemGeneratedfailedCount 1
}
else
{
Assert-statlight-xml-report-results -message "Execute-MSTest-Version-Acceptance-Tests" -resultsXmlTextFilePath $scriptFile -expectedPassedCount 5 -expectedFailedCount 2 -expectedIgnoredCount 1 -expectedSystemGeneratedfailedCount 1
Assert-statlight-xml-report-results -message "Execute-MSTest-Version-Acceptance-Tests" -resultsXmlTextFilePath $scriptFile -expectedPassedCount 6 -expectedFailedCount 2 -expectedIgnoredCount 1 -expectedSystemGeneratedfailedCount 1
}

#added sleep to wait for file system to loose the lock on the file so we can delete it
Expand Down
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Reflection;
using System.Windows;
using Microsoft.Silverlight.Testing;

namespace StatLight.Client.Harness.Hosts.MSTest
{
[Export(typeof(IRemotelyHostedTestRunnerHost))]
public class MSTestRemotelyHostedTestRunnerHost : IRemotelyHostedTestRunnerHost
{
public UIElement StartRun(IEnumerable<Assembly> assemblyToTest)
Expand Down
11 changes: 7 additions & 4 deletions src/StatLight.Client.Harness.MSTest/MSTestRunnerHost.cs
@@ -1,5 +1,4 @@
using System.ComponentModel.Composition;
using System.Windows;
using System.Windows;
using Microsoft.Silverlight.Testing;
using Microsoft.Silverlight.Testing.Harness;
using StatLight.Client.Harness.Events;
Expand All @@ -13,7 +12,6 @@

namespace StatLight.Client.Harness.Hosts.MSTest
{
[Export(typeof(ITestRunnerHost))]
public class MSTestRunnerHost : ITestRunnerHost
{
private ClientTestRunConfiguration _clientTestRunConfiguration;
Expand All @@ -31,11 +29,16 @@ public void ConfigureWithLoadedXapData(ILoadedXapData loadedXapData)

public UIElement StartRun()
{
Server.Debug("MSTestRunnerHost.StartRun()");
SetupUnitTestProvider(_clientTestRunConfiguration.UnitTestProviderType);
Server.Debug("Completed - SetupUnitTestProvider(" + _clientTestRunConfiguration.UnitTestProviderType + ")");

var settings = ConfigureSettings();
Server.Debug("Completed - ConfigureSettings()");

return UnitTestSystem.CreateTestPage(settings);
var ui = UnitTestSystem.CreateTestPage(settings);
Server.Debug("Completed - UnitTestSystem.CreateTestPage(...)");
return ui;
}

private void CurrentHarness_TestHarnessCompleted(object sender, TestHarnessCompletedEventArgs e)
Expand Down
Expand Up @@ -60,7 +60,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Silverlight\Microsoft\May2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Windows" />
<Reference Include="mscorlib" />
<Reference Include="system" />
Expand Down
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
using Microsoft.Silverlight.Testing.UnitTesting.Metadata;
using StatLight.Client.Harness.Messaging;
using StatLight.Core.Configuration;

namespace StatLight.Client.Harness.Hosts.MSTest.UnitTestProviders.MSTest
Expand Down Expand Up @@ -133,7 +134,15 @@ public ICollection<ITestMethod> GetTestMethods()
foreach (MethodInfo method in methods)
{
if (ClientTestRunConfiguration.ContainsMethod(method))
_tests.Add(new TestMethod(method));
{
Console.WriteLine("Begin - Adding method to test: " + method.FullName());
Server.Debug("Adding method to test: " + method.FullName());
// Using the MSTest frameworks's TestMethod here because
// 1. There is no specific StatLight logic in the original ITestMethod implemenation done by StatLight
// 2. The UnitTestContext class in the SL Testing Framework is protected and therefore I can't create that instance
_tests.Add(new Microsoft.Silverlight.Testing.UnitTesting.Metadata.VisualStudio.TestMethod(method));
Console.WriteLine("END - Adding method to test: " + method.FullName());
}
}
_testsLoaded = true;
}
Expand Down

0 comments on commit 43708ae

Please sign in to comment.