forked from ninject/Ninject.MockingKernel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
972 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Rhino Mocks is using Castle Dynamic Proxy (http://www.castleproject.org/dynamicproxy/index.html) to handle proxying the types it needs to mock. | ||
The Dynamic Proxy project has been invaluable resource and made creating Rhino Mocks possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2005 - 2009 Ayende Rahien (ayende@ayende.com) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of Ayende Rahien nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="Ninject.MockingKernel.SilverlightTests.App" | ||
> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
namespace Ninject.MockingKernel.SilverlightTests | ||
{ | ||
using System; | ||
using System.Windows; | ||
#if SILVERLIGHT_MSTEST | ||
using Microsoft.Silverlight.Testing; | ||
#endif | ||
|
||
public partial class App : Application | ||
{ | ||
private bool contentLoaded; | ||
|
||
public App() | ||
{ | ||
this.Startup += this.Application_Startup; | ||
this.Exit += this.Application_Exit; | ||
this.UnhandledException += this.Application_UnhandledException; | ||
|
||
this.CustomInitializeComponent(); | ||
} | ||
|
||
/// <summary> | ||
/// InitializeComponent | ||
/// </summary> | ||
public void CustomInitializeComponent() | ||
{ | ||
if (this.contentLoaded) | ||
{ | ||
return; | ||
} | ||
this.contentLoaded = true; | ||
System.Windows.Application.LoadComponent(this, new System.Uri("/Ninject.SilverlightTests;component/App.xaml", System.UriKind.Relative)); | ||
} | ||
|
||
private void Application_Startup(object sender, StartupEventArgs e) | ||
{ | ||
#if SILVERLIGHT_MSTEST | ||
RootVisual = UnitTestSystem.CreateTestPage(); | ||
#endif | ||
} | ||
|
||
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) | ||
{ | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Ninject.MockingKernel.SilverlightTests/AppManifest.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Ninject.MockingKernel.SilverlightTests" EntryPointType="Ninject.MockingKernel.SilverlightTests.App" RuntimeVersion="4.0.50401.0"> | ||
<Deployment.Parts> | ||
<AssemblyPart x:Name="Ninject.MockingKernel.SilverlightTests" Source="Ninject.MockingKernel.SilverlightTests.dll" /> | ||
<AssemblyPart x:Name="Moq.Silverlight" Source="Moq.Silverlight.dll" /> | ||
<AssemblyPart x:Name="Ninject" Source="Ninject.dll" /> | ||
<AssemblyPart x:Name="Ninject.MockingKernel" Source="Ninject.MockingKernel.dll" /> | ||
<AssemblyPart x:Name="Ninject.MockingKernel.Moq" Source="Ninject.MockingKernel.Moq.dll" /> | ||
<!--<AssemblyPart x:Name="Ninject.MockingKernel.RhinoMock" Source="Ninject.MockingKernel.RhinoMock.dll" />--> | ||
<AssemblyPart x:Name="Castle.Core-Silverlight" Source="Castle.Core-Silverlight.dll" /> | ||
<AssemblyPart x:Name="Castle.DynamicProxy-Silverlight" Source="Castle.DynamicProxy-Silverlight.dll" /> | ||
<AssemblyPart x:Name="UnitDrivenLight" Source="UnitDrivenLight.dll" /> | ||
</Deployment.Parts> | ||
</Deployment> |
38 changes: 38 additions & 0 deletions
38
src/Ninject.MockingKernel.SilverlightTests/AssertWithThrows.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace Ninject.SilverlightTests | ||
{ | ||
using System; | ||
using System.Globalization; | ||
#if SILVERLIGHT_MSTEST | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
#else | ||
using Assert = UnitDriven.Assert; | ||
#endif | ||
|
||
public class AssertWithThrows | ||
{ | ||
public static void DoesNotThrow(Action action) | ||
{ | ||
try | ||
{ | ||
action(); | ||
} | ||
catch (Exception) | ||
{ | ||
Assert.Fail("Expected no exception"); | ||
} | ||
} | ||
|
||
public static void Throws<T>(Action action) | ||
where T : Exception | ||
{ | ||
try | ||
{ | ||
action(); | ||
Assert.Fail(string.Format(CultureInfo.InvariantCulture, "Expected excpetion {0} did not occur!", typeof(T).Name)); | ||
} | ||
catch (T) | ||
{ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.