Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a solution to enable testing of the Silverlight version of the ass... #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Castle.Core-SL-vs2010.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8C53C104-3557-4C1A-B653-C4E6C46DB48E}"
ProjectSection(SolutionItems) = preProject
Changes-logging.txt = Changes-logging.txt
Changes.txt = Changes.txt
License.txt = License.txt
Settings.proj = Settings.proj
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Castle.Core-SL-vs2010", "src\Castle.Core\Castle.Core-SL-vs2010.csproj", "{E4FA5B53-7D36-429E-8E5C-53D5479242BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Castle.Core.Tests-SL-vs2010", "src\Castle.Core.Tests-SL-vs2010\Castle.Core.Tests-SL-vs2010.csproj", "{733971E4-EB04-4D76-8B08-E758474881D8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
ReleaseSL3|Any CPU = ReleaseSL3|Any CPU
ReleaseSL4|Any CPU = ReleaseSL4|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.Release|Any CPU.Build.0 = Release|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.ReleaseSL3|Any CPU.ActiveCfg = Release|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.ReleaseSL3|Any CPU.Build.0 = Release|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.ReleaseSL4|Any CPU.ActiveCfg = Release|Any CPU
{E4FA5B53-7D36-429E-8E5C-53D5479242BA}.ReleaseSL4|Any CPU.Build.0 = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.Release|Any CPU.Build.0 = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.ReleaseSL3|Any CPU.ActiveCfg = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.ReleaseSL3|Any CPU.Build.0 = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.ReleaseSL4|Any CPU.ActiveCfg = Release|Any CPU
{733971E4-EB04-4D76-8B08-E758474881D8}.ReleaseSL4|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added lib/silverlight-4.0/NUnitSilverlight.dll
Binary file not shown.
Binary file added lib/silverlight-4.0/nunit.framework.dll
Binary file not shown.
Binary file added lib/silverlight-4.0/nunit.silverlight.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions src/Castle.Core.Tests-SL-vs2010/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Castle.Core.Tests_SL_vs2010.App"
>
<Application.Resources>

</Application.Resources>
</Application>
61 changes: 61 additions & 0 deletions src/Castle.Core.Tests-SL-vs2010/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Windows;
using Microsoft.Silverlight.Testing;
using Microsoft.Silverlight.Testing.UnitTesting.Metadata.NUnit;

namespace Castle.Core.Tests_SL_vs2010
{
public partial class App : Application
{

public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;

InitializeComponent();
}

private void Application_Startup(object sender, StartupEventArgs e)
{
// RootVisual = UnitTestSystem.CreateTestPage();
UnitTestSystem.RegisterUnitTestProvider(new NUnitProvider());
RootVisual = UnitTestSystem.CreateTestPage();
}

private void Application_Exit(object sender, EventArgs e)
{

}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// 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.
if (!System.Diagnostics.Debugger.IsAttached)
{

// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
Loading