75 changed files with 2540 additions and 258 deletions
@ -0,0 +1,56 @@ |
|||||||
|
Copyright (c) 2011 Machine.Fakes Project |
||||||
|
Portions Copyright (c) 2011 Bjoern Rochel, Steffen Forkmann |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
of this software and associated documentation files (the "Software"), to deal |
||||||
|
in the Software without restriction, including without limitation the rights |
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
copies of the Software, and to permit persons to whom the Software is |
||||||
|
furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in |
||||||
|
all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||||
|
THE SOFTWARE. |
||||||
|
|
||||||
|
***************************** |
||||||
|
Some parts licensed under MS-PL |
||||||
|
***************************** |
||||||
|
|
||||||
|
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. |
||||||
|
|
||||||
|
1. Definitions |
||||||
|
|
||||||
|
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. |
||||||
|
|
||||||
|
A "contribution" is the original software, or any additions or changes to the software. |
||||||
|
|
||||||
|
A "contributor" is any person that distributes its contribution under this license. |
||||||
|
|
||||||
|
"Licensed patents" are a contributor's patent claims that read directly on its contribution. |
||||||
|
|
||||||
|
2. Grant of Rights |
||||||
|
|
||||||
|
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. |
||||||
|
|
||||||
|
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. |
||||||
|
|
||||||
|
3. Conditions and Limitations |
||||||
|
|
||||||
|
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. |
||||||
|
|
||||||
|
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. |
||||||
|
|
||||||
|
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. |
||||||
|
|
||||||
|
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. |
||||||
|
|
||||||
|
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. |
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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. |
||||||
@ -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. |
||||||
@ -0,0 +1,53 @@ |
|||||||
|
Copyright (c) 2011 Develop With Passion® |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
of this software and associated documentation files (the "Software"), to deal |
||||||
|
in the Software without restriction, including without limitation the rights |
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
copies of the Software, and to permit persons to whom the Software is |
||||||
|
furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in |
||||||
|
all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||||
|
THE SOFTWARE. |
||||||
|
|
||||||
|
***************************** |
||||||
|
Some parts licensed under MS-PL |
||||||
|
***************************** |
||||||
|
|
||||||
|
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. |
||||||
|
|
||||||
|
1. Definitions |
||||||
|
|
||||||
|
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. |
||||||
|
|
||||||
|
A "contribution" is the original software, or any additions or changes to the software. |
||||||
|
|
||||||
|
A "contributor" is any person that distributes its contribution under this license. |
||||||
|
|
||||||
|
"Licensed patents" are a contributor's patent claims that read directly on its contribution. |
||||||
|
|
||||||
|
2. Grant of Rights |
||||||
|
|
||||||
|
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. |
||||||
|
|
||||||
|
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. |
||||||
|
|
||||||
|
3. Conditions and Limitations |
||||||
|
|
||||||
|
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. |
||||||
|
|
||||||
|
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. |
||||||
|
|
||||||
|
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. |
||||||
|
|
||||||
|
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. |
||||||
|
|
||||||
|
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. |
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,21 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<MSpec> |
||||||
|
<run time="115" /> |
||||||
|
<assembly name="MSpecTest1" location="C:\Users\trecio\Documents\SharpDevelop Projects\MSpecTest\MSpecTest1\bin\Debug\MSpecTest1.dll" time="52"> |
||||||
|
<concern name=""> |
||||||
|
<context name="TestClass" type-name="Namespace.TestClass"> |
||||||
|
<specification name="PassedTest" field-name="Passed_Test" status="passed" /> |
||||||
|
<specification name="FailedTest" field-name="Failed_Test" status="failed"> |
||||||
|
<error> |
||||||
|
<message> |
||||||
|
<![CDATA[Test failure description.]]> |
||||||
|
</message> |
||||||
|
<stack-trace><![CDATA[Stack trace]]></stack-trace> |
||||||
|
</error> |
||||||
|
</specification> |
||||||
|
<specification name="NotImplementedTest" field-name="Not_Implemented_Test" status="not-implemented" /> |
||||||
|
<specification name="IgnoredTest" field-name="Ignored_Test" status="ignored" /> |
||||||
|
</context> |
||||||
|
</concern> |
||||||
|
</assembly> |
||||||
|
</MSpec> |
||||||
@ -0,0 +1,96 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||||
|
<PropertyGroup> |
||||||
|
<ProjectGuid>{172AE35D-2051-4977-AC13-0BF1B76374D5}</ProjectGuid> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>ICSharpCode.MachineSpecifications.Tests</RootNamespace> |
||||||
|
<AssemblyName>MachineSpecifications.Tests</AssemblyName> |
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||||
|
<TargetFrameworkProfile> |
||||||
|
</TargetFrameworkProfile> |
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<OutputPath>..\..\..\..\..\bin\UnitTests\</OutputPath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<DebugSymbols>True</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="developwithpassion.specifications"> |
||||||
|
<HintPath>..\Libraries\developwithpassion.specifications.rhinomocks.0.4.13.0\developwithpassion.specifications.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="developwithpassion.specifications.rhinomocks"> |
||||||
|
<HintPath>..\Libraries\developwithpassion.specifications.rhinomocks.0.4.13.0\developwithpassion.specifications.rhinomocks.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="Machine.Fakes"> |
||||||
|
<HintPath>..\Libraries\Machine.Fakes\Machine.Fakes.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="Machine.Fakes.Adapters.RhinoMocks"> |
||||||
|
<HintPath>..\Libraries\Machine.Fakes\Machine.Fakes.Adapters.RhinoMocks.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="Machine.Specifications"> |
||||||
|
<HintPath>..\..\..\..\Tools\Machine.Specifications\Machine.Specifications.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="Rhino.Mocks"> |
||||||
|
<HintPath>..\Libraries\RhinoMocks.3.6\Rhino.Mocks.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Core"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Xml.Linq"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="Src\ClassFilterBuilder.cs" /> |
||||||
|
<Compile Include="Src\MSpecTestFrameworkTests.cs" /> |
||||||
|
<Compile Include="Src\MSpecUnitTestMonitorTests.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Content Include="Data\MSpecUnitTestMonitorTestsSampleData.xml"> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</Content> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="packages.config" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||||
|
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\UnitTesting\UnitTesting.csproj"> |
||||||
|
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project> |
||||||
|
<Name>UnitTesting</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\MachineSpecifications\MachineSpecifications.csproj"> |
||||||
|
<Project>{D1DA3B8F-7313-4BDA-8880-461C5F007751}</Project> |
||||||
|
<Name>MachineSpecifications</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
#region Using directives
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("MachineSpecifications.Tests")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("MachineSpecifications.Tests")] |
||||||
|
[assembly: AssemblyCopyright("Copyright 2011")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can use the default the Revision and
|
||||||
|
// Build Numbers by using the '*' as shown below:
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-09-23 |
||||||
|
* Time: 19:53 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using developwithpassion.specifications.extensions; |
||||||
|
using developwithpassion.specifications.rhinomocks; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using Machine.Specifications; |
||||||
|
using Machine.Fakes.Adapters.Rhinomocks; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications.Tests |
||||||
|
{ |
||||||
|
[Subject(typeof(ClassFilterBuilder))] |
||||||
|
public class When_building_class_filter_from_test_selection : Observes<ClassFilterBuilder> |
||||||
|
{ |
||||||
|
const string NAMESPACE_FILTER = "Namespace"; |
||||||
|
static DefaultClass classAddedExplicitly, classInNamespace, classOutsideNamespace, classNestedInAddedExplicitly, classNestedInClassInNamespace; |
||||||
|
static SelectedTests selectedTests; |
||||||
|
static IProjectContent projectContent; |
||||||
|
static IList<string> result; |
||||||
|
|
||||||
|
Establish ctx = () => { |
||||||
|
projectContent = fake.an<IProjectContent>(); |
||||||
|
projectContent.setup(x => x.SystemTypes).Return(new SystemTypes(projectContent)); |
||||||
|
var compilationUnit = new DefaultCompilationUnit(projectContent); |
||||||
|
|
||||||
|
classAddedExplicitly = new DefaultClass(compilationUnit, "ClassAddedExplicitly"); |
||||||
|
classNestedInAddedExplicitly = new DefaultClass(compilationUnit, classAddedExplicitly); |
||||||
|
classNestedInAddedExplicitly.FullyQualifiedName = "ClassAddedExplicitly.InnerClass"; |
||||||
|
classAddedExplicitly.InnerClasses.Add(classNestedInAddedExplicitly); |
||||||
|
|
||||||
|
classInNamespace = new DefaultClass(compilationUnit, "Namespace.OtherNamespace.ClassInNamespace"); |
||||||
|
classNestedInClassInNamespace = new DefaultClass(compilationUnit, classInNamespace); |
||||||
|
classNestedInClassInNamespace.FullyQualifiedName = "Namespace.OtherNamespace.ClassInNamespace.InnerClass"; |
||||||
|
classInNamespace.InnerClasses.Add(classNestedInClassInNamespace); |
||||||
|
classOutsideNamespace = new DefaultClass(compilationUnit, "Namespace2.ClassOutsideNamespac"); |
||||||
|
|
||||||
|
var project = fake.an<IProject>(); |
||||||
|
projectContent.setup(x => x.Classes).Return(new[]{classInNamespace, classOutsideNamespace}); |
||||||
|
|
||||||
|
selectedTests = new SelectedTests(project, NAMESPACE_FILTER, classAddedExplicitly, null); |
||||||
|
}; |
||||||
|
|
||||||
|
Because of = () => |
||||||
|
result = sut.BuildFilterFor(selectedTests, projectContent); |
||||||
|
|
||||||
|
It should_add_dotnet_name_of_selected_test_class = () => |
||||||
|
result.ShouldContain(classAddedExplicitly.DotNetName); |
||||||
|
|
||||||
|
It should_add_class_included_in_selected_namespace = () => |
||||||
|
result.ShouldContain(classInNamespace.DotNetName); |
||||||
|
|
||||||
|
It should_not_include_class_not_included_in_namespace = () => |
||||||
|
result.ShouldNotContain(classOutsideNamespace.DotNetName); |
||||||
|
|
||||||
|
It should_not_include_class_nested_in_selected_test_class = () => |
||||||
|
result.ShouldNotContain(classNestedInAddedExplicitly.DotNetName); |
||||||
|
|
||||||
|
It should_include_class_nested_in_class_from_selected_namespace = () => |
||||||
|
result.ShouldContain(classNestedInClassInNamespace.DotNetName); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,193 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-06-18 |
||||||
|
* Time: 15:12 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
using System.Linq; |
||||||
|
using developwithpassion.specifications.extensions; |
||||||
|
using developwithpassion.specifications.dsl; |
||||||
|
using developwithpassion.specifications.rhinomocks; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using Machine.Specifications; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using Rhino.Mocks; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications.Tests |
||||||
|
{ |
||||||
|
[Subject(typeof(MSpecTestFramework))] |
||||||
|
public class When_checking_if_is_a_test_project : Observes<MSpecTestFramework> |
||||||
|
{ |
||||||
|
static IProject testProject; |
||||||
|
static IProject nonTestProject; |
||||||
|
|
||||||
|
static bool resultForTestProject; |
||||||
|
static bool resultForNonTestProject; |
||||||
|
|
||||||
|
const string MSpecAssemblyName = "Machine.Specifications"; |
||||||
|
|
||||||
|
Establish ctx = () => |
||||||
|
{ |
||||||
|
testProject = fake.an<IProject>(); |
||||||
|
var mspecReference = MockRepository.GenerateStub<ReferenceProjectItem>(testProject); |
||||||
|
mspecReference.setup(x => x.ShortName).Return(MSpecAssemblyName); |
||||||
|
testProject.setup(x => x.Items).Return(new ReadOnlyCollection<ProjectItem>(new[] { mspecReference })); |
||||||
|
|
||||||
|
nonTestProject = fake.an<IProject>(); |
||||||
|
var otherReference = MockRepository.GenerateStub<ReferenceProjectItem>(nonTestProject); |
||||||
|
mspecReference.setup(x => x.ShortName).Return("System.Configuration"); |
||||||
|
nonTestProject.setup(x => x.Items).Return(new ReadOnlyCollection<ProjectItem>(new[] { otherReference })); |
||||||
|
}; |
||||||
|
|
||||||
|
Because of = () => |
||||||
|
{ |
||||||
|
resultForTestProject = sut.IsTestProject(testProject); |
||||||
|
resultForNonTestProject = sut.IsTestProject(nonTestProject); |
||||||
|
}; |
||||||
|
|
||||||
|
It should_return_true_for_project_which_has_reference_to_test_framework = () => |
||||||
|
resultForTestProject.ShouldBeTrue(); |
||||||
|
|
||||||
|
It should_return_false_for_project_which_has_no_reference_to_test_framework = () => |
||||||
|
resultForNonTestProject.ShouldBeFalse(); |
||||||
|
} |
||||||
|
|
||||||
|
public abstract class MSpecTestFrameworkFieldsConcern : Observes<MSpecTestFramework> |
||||||
|
{ |
||||||
|
protected static ICompilationUnit CompilationUnit; |
||||||
|
|
||||||
|
Establish ctx = () => |
||||||
|
{ |
||||||
|
var ProjectContent = fake.an<IProjectContent>(); |
||||||
|
ProjectContent.setup(x => x.SystemTypes).Return(new SystemTypes(ProjectContent)); |
||||||
|
CompilationUnit = new DefaultCompilationUnit(ProjectContent); |
||||||
|
}; |
||||||
|
|
||||||
|
protected const string MSpecItTypeName = "Machine.Specifications.It"; |
||||||
|
protected const string MSpecBehavesTypeName = "Machine.Specifications.Behaves_like"; |
||||||
|
protected const string MSpecBehaviorTypeName = "Machine.Specifications.BehaviorsAttribute"; |
||||||
|
|
||||||
|
protected static IClass SetupClass(bool isAbstract, IList<IField> fields, IList<IAttribute> attributes) |
||||||
|
{ |
||||||
|
var c = fake.an<IClass>(); |
||||||
|
c.setup(x => x.IsAbstract).Return(isAbstract); |
||||||
|
c.setup(x => x.Fields).Return(fields); |
||||||
|
c.setup(x => x.Attributes).Return(attributes); |
||||||
|
return c; |
||||||
|
} |
||||||
|
|
||||||
|
protected static IField SetupField(string returnTypeName) |
||||||
|
{ |
||||||
|
var field = fake.an<IField>(); |
||||||
|
field.ReturnType = SetupReturnType(returnTypeName); |
||||||
|
return field; |
||||||
|
} |
||||||
|
|
||||||
|
protected static IAttribute SetupBehaviorAttribute() |
||||||
|
{ |
||||||
|
var attribute = fake.an<IAttribute>(); |
||||||
|
attribute.setup(x => x.AttributeType).Return(SetupReturnType(MSpecBehaviorTypeName)); |
||||||
|
return attribute; |
||||||
|
} |
||||||
|
|
||||||
|
protected static IReturnType SetupReturnType(string typeName) |
||||||
|
{ |
||||||
|
var returnType = fake.an<IReturnType>(); |
||||||
|
returnType.Stub(x => x.FullyQualifiedName).Return(typeName); |
||||||
|
return returnType; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[Subject(typeof(MSpecTestFramework))] |
||||||
|
public class When_checking_if_is_a_test_class : MSpecTestFrameworkFieldsConcern |
||||||
|
{ |
||||||
|
static IClass classWithoutSpecificationMembers; |
||||||
|
static IClass classWithSpecificationMembers; |
||||||
|
static IClass classWithBehavior; |
||||||
|
static IClass classWithSpecificationMembersAndBehaviorAttribute; |
||||||
|
|
||||||
|
static bool resultForClassWithBehaviorAttribute; |
||||||
|
static bool resultForClassWithSpecifications; |
||||||
|
static bool resultForClassWithBehavior; |
||||||
|
static bool resultForClassWithoutSpecifications; |
||||||
|
|
||||||
|
Establish ctx = () => |
||||||
|
{ |
||||||
|
classWithoutSpecificationMembers = SetupClass(false, new IField[0], new IAttribute[0]); |
||||||
|
classWithSpecificationMembers = SetupClass(false, new IField[] { SetupField(MSpecItTypeName) }, new IAttribute[0]); |
||||||
|
classWithBehavior = SetupClass(false, new IField[] { SetupField(MSpecBehavesTypeName) }, new IAttribute[0]); |
||||||
|
classWithSpecificationMembersAndBehaviorAttribute = SetupClass(false, new IField[] { SetupField(MSpecItTypeName) }, new IAttribute[] { SetupBehaviorAttribute() }); |
||||||
|
}; |
||||||
|
|
||||||
|
Because of = () => |
||||||
|
{ |
||||||
|
resultForClassWithoutSpecifications = sut.IsTestClass(classWithoutSpecificationMembers); |
||||||
|
resultForClassWithSpecifications = sut.IsTestClass(classWithSpecificationMembers); |
||||||
|
resultForClassWithBehavior = sut.IsTestClass(classWithBehavior); |
||||||
|
resultForClassWithBehaviorAttribute = sut.IsTestClass(classWithSpecificationMembersAndBehaviorAttribute); |
||||||
|
}; |
||||||
|
|
||||||
|
It should_return_false_for_class_without_specification_members = () => |
||||||
|
resultForClassWithoutSpecifications.ShouldBeFalse(); |
||||||
|
|
||||||
|
It should_return_true_for_class_with_specification_members = () => |
||||||
|
resultForClassWithSpecifications.ShouldBeTrue(); |
||||||
|
|
||||||
|
It should_return_true_for_class_with_behavior = () => |
||||||
|
resultForClassWithBehavior.ShouldBeTrue(); |
||||||
|
|
||||||
|
It should_return_false_for_class_with_behavior_attribute = () => |
||||||
|
resultForClassWithBehaviorAttribute.ShouldBeFalse(); |
||||||
|
} |
||||||
|
|
||||||
|
public class When_enumerating_test_members : MSpecTestFrameworkFieldsConcern |
||||||
|
{ |
||||||
|
static IClass behaviorClass; |
||||||
|
static IField testSpecificationInBehavior; |
||||||
|
|
||||||
|
static IClass testClass; |
||||||
|
static IField testSpecification; |
||||||
|
static IField otherField; |
||||||
|
static IField behavesLikeField; |
||||||
|
|
||||||
|
static IEnumerable<TestMember> result; |
||||||
|
|
||||||
|
const string BehaviorClassName = "Test.Behavior"; |
||||||
|
|
||||||
|
Establish ctx = () => |
||||||
|
{ |
||||||
|
var itReturnType = SetupReturnType(MSpecItTypeName); |
||||||
|
|
||||||
|
behaviorClass = new DefaultClass(CompilationUnit, "BehaviorClass"); |
||||||
|
testSpecificationInBehavior = new DefaultField(itReturnType, "testSpecificationInBehavior", ModifierEnum.None, DomRegion.Empty, behaviorClass); |
||||||
|
behaviorClass.Fields.Add(testSpecificationInBehavior); |
||||||
|
|
||||||
|
testClass = new DefaultClass(CompilationUnit, "TestClass"); |
||||||
|
testSpecification = new DefaultField(itReturnType, "testSpecification", ModifierEnum.None, DomRegion.Empty, testClass); |
||||||
|
testClass.Fields.Add(testSpecification); |
||||||
|
otherField = new DefaultField(fake.an<IReturnType>(), "OtherField", ModifierEnum.None, DomRegion.Empty, testClass); |
||||||
|
testClass.Fields.Add(otherField); |
||||||
|
|
||||||
|
var behavesLikeReturnType = new ConstructedReturnType(SetupReturnType(MSpecBehavesTypeName), new List<IReturnType>{new DefaultReturnType(behaviorClass)}); |
||||||
|
behavesLikeField = new DefaultField(behavesLikeReturnType, "behavesLikeField", ModifierEnum.None, new DomRegion(), testClass); |
||||||
|
testClass.Fields.Add(behavesLikeField); |
||||||
|
}; |
||||||
|
|
||||||
|
Because of = () => result = sut.GetTestMembersFor(testClass); |
||||||
|
|
||||||
|
It should_contain_field_with_it_return_type = () => |
||||||
|
result.Select(m => m.Member).ShouldContain(testSpecification); |
||||||
|
|
||||||
|
It should_not_contain_field_with_arbitrary_return_type = () => |
||||||
|
result.Select(m => m.Member).ShouldNotContain(otherField); |
||||||
|
|
||||||
|
It should_contain_imported_field_from_behavior = () => |
||||||
|
result.Select(m => m.Member).ShouldContain(member => member.FullyQualifiedName == "TestClass.testSpecificationInBehavior"); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.IO; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using Machine.Specifications; |
||||||
|
using developwithpassion.specifications.rhinomocks; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications.Tests.Src |
||||||
|
{ |
||||||
|
public class When_getting_test_results_from_external_runner : Observes<MSpecUnitTestMonitor> |
||||||
|
{ |
||||||
|
private Because of = () => |
||||||
|
{ |
||||||
|
sut.Start(); |
||||||
|
sut.TestFinished += (source, e) => FinishedTests.Add(e.Result);; |
||||||
|
sut.FileName = FILE_NAME; |
||||||
|
sut.Read(); |
||||||
|
sut.Stop(); |
||||||
|
}; |
||||||
|
|
||||||
|
private It should_create_test_result_for_passed_test_with_status_set_to_success = () => |
||||||
|
AssertHasResultType("Namespace.TestClass.Passed_Test", TestResultType.Success); |
||||||
|
|
||||||
|
private It should_create_result_for_failed_test_with_status_set_to_failure = () => |
||||||
|
AssertHasResultType("Namespace.TestClass.Failed_Test", TestResultType.Failure); |
||||||
|
|
||||||
|
private It should_have_stack_trace_for_failed_test = () => |
||||||
|
FinishedTests.Where(t => t.ResultType == TestResultType.Failure) |
||||||
|
.Select(t => t.StackTrace).ShouldContainOnly("Stack trace"); |
||||||
|
|
||||||
|
private It should_have_message_for_failed_test = () => |
||||||
|
FinishedTests.Where(t => t.ResultType == TestResultType.Failure) |
||||||
|
.Select(t => t.Message).ShouldContainOnly("Test failure description."); |
||||||
|
|
||||||
|
private It should_create_result_for_not_implemented_test_with_status_set_to_ignored = () => |
||||||
|
AssertHasResultType("Namespace.TestClass.Not_Implemented_Test", TestResultType.Ignored); |
||||||
|
|
||||||
|
private It should_create_result_for_ignored_test_with_status_set_to_ignored = () => |
||||||
|
AssertHasResultType("Namespace.TestClass.Ignored_Test", TestResultType.Ignored); |
||||||
|
|
||||||
|
private static readonly string FILE_NAME = @"Data\\MSpecUnitTestMonitorTestsSampleData.xml"; |
||||||
|
private static readonly IList<TestResult> FinishedTests = new List<TestResult>(); |
||||||
|
|
||||||
|
private static void AssertHasResultType(string testName, TestResultType result) |
||||||
|
{ |
||||||
|
FinishedTests.ShouldContain(x => x.Name == testName); |
||||||
|
FinishedTests.Single(x => x.Name == testName).ResultType.ShouldEqual(result); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<packages> |
||||||
|
<package id="Machine.Specifications" version="0.4.13.0" /> |
||||||
|
<package id="Machine.Fakes" version="0.2.3.3" /> |
||||||
|
<package id="RhinoMocks" version="3.6" /> |
||||||
|
<package id="Machine.Fakes.RhinoMocks" version="0.2.3.3" /> |
||||||
|
<package id="developwithpassion.specifications.rhinomocks" version="0.4.13.0" /> |
||||||
|
</packages> |
||||||
@ -0,0 +1,77 @@ |
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 11.00 |
||||||
|
# Visual Studio 2010 |
||||||
|
# SharpDevelop 4.2.0.8235-alpha |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MachineSpecifications", "MachineSpecifications\MachineSpecifications.csproj", "{D1DA3B8F-7313-4BDA-8880-461C5F007751}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MachineSpecifications.Tests", "MachineSpecifications.Tests\MachineSpecifications.Tests.csproj", "{172AE35D-2051-4977-AC13-0BF1B76374D5}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "..\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" |
||||||
|
EndProject |
||||||
|
Global |
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||||
|
Debug|Any CPU = Debug|Any CPU |
||||||
|
Debug|x86 = Debug|x86 |
||||||
|
Release|Any CPU = Release|Any CPU |
||||||
|
Release|x86 = Release|x86 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Debug|x86.ActiveCfg = Debug|x86 |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Debug|x86.Build.0 = Debug|x86 |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Release|x86.ActiveCfg = Release|x86 |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Release|x86.Build.0 = Release|x86 |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Debug|x86.Build.0 = Debug|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Release|x86.ActiveCfg = Release|Any CPU |
||||||
|
{172AE35D-2051-4977-AC13-0BF1B76374D5}.Release|x86.Build.0 = Release|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.Build.0 = Debug|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.ActiveCfg = Release|Any CPU |
||||||
|
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.Build.0 = Release|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.Build.0 = Debug|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.ActiveCfg = Release|Any CPU |
||||||
|
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.Build.0 = Release|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.Build.0 = Debug|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU |
||||||
|
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.Build.0 = Debug|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.ActiveCfg = Release|Any CPU |
||||||
|
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.Build.0 = Release|Any CPU |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{D1DA3B8F-7313-4BDA-8880-461C5F007751}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(SolutionProperties) = preSolution |
||||||
|
HideSolutionNode = FALSE |
||||||
|
EndGlobalSection |
||||||
|
EndGlobal |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
You have created a new SharpDevelop AddIn project. |
||||||
|
|
||||||
|
We would like to point out that there are three locations where you can get information on how |
||||||
|
to write SharpDevelop AddIns: |
||||||
|
- http://wiki.sharpdevelop.net/ (section Developer Zone) |
||||||
|
- The folder "doc/technotes" in the SharpDevelop source code download |
||||||
|
- You can ask questions about AddIn development in the SharpDevelop forum: |
||||||
|
http://community.sharpdevelop.net/forums/ |
||||||
|
|
||||||
|
The next steps: |
||||||
|
- First, you have to add references to the SharpDevelop assemblies. |
||||||
|
An AddIn will work with the SharpDevelop version it was compiled for, or later service releases. |
||||||
|
You might want to compile against SharpDevelop 3.0.0.3800 (the first official release of SharpDevelop 3) |
||||||
|
to ensure your AddIn runs with all later 3.x versions of SharpDevelop. |
||||||
|
|
||||||
|
- Include a <Manifest> section to your .addin for use with the SharpDevelop AddIn Manager. |
||||||
|
See SharpDevelop/doc/technotes/AddInManager.rtf for more information. |
||||||
|
|
||||||
|
- Once you have published your AddIn on the Internet, please add it to the SharpDevelop wiki to let other users know! |
||||||
|
http://wiki.sharpdevelop.net/3rdPartyAddins.ashx |
||||||
|
|
||||||
|
|
||||||
|
This file serves as a reminder for you on how to find information on SharpDevelop AddIn development, you can |
||||||
|
remove it from your project if you don't need it anymore. |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
#region Using directives
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("MachineSpecifications")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("MachineSpecifications")] |
||||||
|
[assembly: AssemblyCopyright("Copyright 2011")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can use the default the Revision and
|
||||||
|
// Build Numbers by using the '*' as shown below:
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<AddIn name = "Machine.Specifications Addin" |
||||||
|
author = "Tomasz Tretkowski" |
||||||
|
url = "" |
||||||
|
description = "Runner for Machine.Specifications unit tests for SharpDevelop"> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly = "MachineSpecifications.dll"/> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<Path name="/SharpDevelop/UnitTesting/TestFrameworks"> |
||||||
|
<TestFramework id="mspec" |
||||||
|
class="ICSharpCode.MachineSpecifications.MSpecTestFramework" |
||||||
|
supportedProjects=".csproj" /> |
||||||
|
</Path> |
||||||
|
</AddIn> |
||||||
@ -0,0 +1,130 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>ICSharpCode.MachineSpecifications</RootNamespace> |
||||||
|
<AssemblyName>MachineSpecifications</AssemblyName> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProjectGuid>{D1DA3B8F-7313-4BDA-8880-461C5F007751}</ProjectGuid> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\Analysis\MachineSpecifications\</OutputPath> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TargetFrameworkProfile> |
||||||
|
</TargetFrameworkProfile> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Core"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Data.DataSetExtensions"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Xml.Linq"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\CommandLine.dll"> |
||||||
|
<Link>Tools\Machine.Specifications\CommandLine.dll</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\License.txt"> |
||||||
|
<Link>Tools\Machine.Specifications\License.txt</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\Machine.Specifications.dll"> |
||||||
|
<Link>Tools\Machine.Specifications\Machine.Specifications.dll</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\Machine.Specifications.Reporting.dll"> |
||||||
|
<Link>Tools\Machine.Specifications\Machine.Specifications.Reporting.dll</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\mspec-clr4.exe"> |
||||||
|
<Link>Tools\Machine.Specifications\mspec-clr4.exe</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\mspec-x86-clr4.exe"> |
||||||
|
<Link>Tools\Machine.Specifications\mspec-x86-clr4.exe</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\mspec-x86.exe"> |
||||||
|
<Link>Tools\Machine.Specifications\mspec-x86.exe</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\mspec.exe"> |
||||||
|
<Link>Tools\Machine.Specifications\mspec.exe</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="..\..\..\..\Tools\Machine.Specifications\Spark.dll"> |
||||||
|
<Link>Tools\Machine.Specifications\Spark.dll</Link> |
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="AddInWritingHelp.txt" /> |
||||||
|
<None Include="MachineSpecifications.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</None> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="src\BehaviorImportedTestMember.cs" /> |
||||||
|
<Compile Include="src\ClassFilterBuilder.cs" /> |
||||||
|
<Compile Include="src\MSpecApplication.cs" /> |
||||||
|
<Compile Include="src\MSpecTestDebugger.cs" /> |
||||||
|
<Compile Include="src\MSpecTestFramework.cs" /> |
||||||
|
<Compile Include="src\MspecTestRunner.cs" /> |
||||||
|
<Compile Include="src\MSpecUnitTestMonitor.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||||
|
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\UnitTesting\UnitTesting.csproj"> |
||||||
|
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project> |
||||||
|
<Name>UnitTesting</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Folder Include="Tools" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<packages> |
||||||
|
<package id="Machine.Specifications" version="0.4.9.0" /> |
||||||
|
</packages> |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-10-24 |
||||||
|
* Time: 23:11 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of BehaviorImportedClass.
|
||||||
|
/// </summary>
|
||||||
|
public class BehaviorImportedTestMember : BaseTestMember |
||||||
|
{ |
||||||
|
public BehaviorImportedTestMember(IClass testClass, IMember behaviorMember) |
||||||
|
: base(testClass, behaviorMember, behaviorMember.Name) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-09-23 |
||||||
|
* Time: 19:40 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Creates class list filter for tests which should be run.
|
||||||
|
/// </summary>
|
||||||
|
public class ClassFilterBuilder |
||||||
|
{ |
||||||
|
public IList<string> BuildFilterFor(SelectedTests tests, IProjectContent @using) { |
||||||
|
var projectContent = @using; |
||||||
|
|
||||||
|
var filter = new List<string>(); |
||||||
|
if (tests.Class != null) |
||||||
|
filter.Add(tests.Class.DotNetName); |
||||||
|
if (tests.NamespaceFilter != null) |
||||||
|
foreach (var projectClass in projectContent.Classes) |
||||||
|
if (projectClass.FullyQualifiedName.StartsWith(tests.NamespaceFilter + ".")) |
||||||
|
Add(projectClass, to: filter); |
||||||
|
|
||||||
|
return filter; |
||||||
|
} |
||||||
|
|
||||||
|
static void Add(IClass @class, IList<string> to) |
||||||
|
{ |
||||||
|
var list = to; |
||||||
|
to.Add(@class.DotNetName); |
||||||
|
foreach (var innerClass in @class.InnerClasses) |
||||||
|
Add(innerClass, to: list); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,138 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-06-18 |
||||||
|
* Time: 14:56 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Diagnostics; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using System.Text; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of MSpecApplication.
|
||||||
|
/// </summary>
|
||||||
|
public class MSpecApplication |
||||||
|
{ |
||||||
|
public MSpecApplication(SelectedTests tests) { |
||||||
|
InitializeFrom(tests); |
||||||
|
} |
||||||
|
|
||||||
|
public ProcessStartInfo GetProcessStartInfo() { |
||||||
|
var result = new ProcessStartInfo(); |
||||||
|
result.FileName = ExecutableFileName; |
||||||
|
result.Arguments = GetArguments(); |
||||||
|
result.WorkingDirectory = WorkingDirectory; |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public string Results {get;set;} |
||||||
|
|
||||||
|
void InitializeFrom(SelectedTests tests) { |
||||||
|
this.tests = tests; |
||||||
|
project = tests.Project; |
||||||
|
} |
||||||
|
|
||||||
|
SelectedTests tests; |
||||||
|
IProject project; |
||||||
|
|
||||||
|
string GetArguments() |
||||||
|
{ |
||||||
|
var builder = new StringBuilder(); |
||||||
|
|
||||||
|
builder.Append("--xml \""); |
||||||
|
builder.Append(FileUtility.GetAbsolutePath(Environment.CurrentDirectory, Results)); |
||||||
|
builder.Append("\" "); |
||||||
|
|
||||||
|
var filterFileName = CreateFilterFile(); |
||||||
|
if (filterFileName != null) |
||||||
|
{ |
||||||
|
builder.Append("-f \""); |
||||||
|
builder.Append(FileUtility.GetAbsolutePath(Environment.CurrentDirectory, filterFileName)); |
||||||
|
builder.Append("\" "); |
||||||
|
} |
||||||
|
|
||||||
|
builder.Append("\""); |
||||||
|
builder.Append(project.OutputAssemblyFullPath); |
||||||
|
builder.Append("\""); |
||||||
|
|
||||||
|
return builder.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
string CreateFilterFile() |
||||||
|
{ |
||||||
|
var classFilterBuilder = new ClassFilterBuilder(); |
||||||
|
var projectContent = ParserService.GetProjectContent(project); |
||||||
|
var filter = classFilterBuilder.BuildFilterFor(tests, @using: projectContent); |
||||||
|
|
||||||
|
string path = null; |
||||||
|
if (filter.Count > 0) { |
||||||
|
path = Path.GetTempFileName(); |
||||||
|
using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write)) |
||||||
|
using (var writer = new StreamWriter(stream)) |
||||||
|
foreach (var testClassName in filter) { |
||||||
|
writer.WriteLine(testClassName); |
||||||
|
} |
||||||
|
} |
||||||
|
return path; |
||||||
|
} |
||||||
|
|
||||||
|
string ExecutableFileName { |
||||||
|
get { |
||||||
|
var assemblyDirectory = Path.GetDirectoryName(new Uri(typeof(MSpecApplication).Assembly.CodeBase).LocalPath); |
||||||
|
var runnerDirectory = Path.Combine(assemblyDirectory, @"Tools\Machine.Specifications"); |
||||||
|
|
||||||
|
string executableName = "mspec"; |
||||||
|
if (TargetPlatformIs32Bit(project)) |
||||||
|
executableName += "-x86"; |
||||||
|
if (UsesClr4(project)) |
||||||
|
executableName += "-clr4"; |
||||||
|
|
||||||
|
executableName += ".exe"; |
||||||
|
return Path.Combine(runnerDirectory, executableName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private bool UsesClr4(IProject project) |
||||||
|
{ |
||||||
|
MSBuildBasedProject msbuildProject = project as MSBuildBasedProject; |
||||||
|
if (msbuildProject != null) |
||||||
|
{ |
||||||
|
string targetFrameworkVersion = msbuildProject.GetEvaluatedProperty("TargetFrameworkVersion"); |
||||||
|
return String.Equals(targetFrameworkVersion, "v4.0", StringComparison.OrdinalIgnoreCase); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
private bool TargetPlatformIs32Bit(IProject project) |
||||||
|
{ |
||||||
|
MSBuildBasedProject msbuildProject = project as MSBuildBasedProject; |
||||||
|
if (msbuildProject != null) |
||||||
|
{ |
||||||
|
string platformTarget = msbuildProject.GetEvaluatedProperty("PlatformTarget"); |
||||||
|
return String.Compare(platformTarget, "x86", true) == 0; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
string WorkingDirectory |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return Path.GetDirectoryName(project.OutputAssemblyFullPath); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-06-18 |
||||||
|
* Time: 14:02 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Diagnostics; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of MSpecTestDebugger.
|
||||||
|
/// </summary>
|
||||||
|
public class MSpecTestDebugger : TestDebuggerBase |
||||||
|
{ |
||||||
|
public MSpecTestDebugger() |
||||||
|
: base(new UnitTestDebuggerService(), new UnitTestMessageService(), new MSpecUnitTestMonitor()) |
||||||
|
{ } |
||||||
|
|
||||||
|
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) |
||||||
|
{ |
||||||
|
var app = new MSpecApplication(selectedTests); |
||||||
|
app.Results = TestResultsMonitor.FileName; |
||||||
|
return app.GetProcessStartInfo(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override TestResult CreateTestResultForTestFramework(TestResult testResult) |
||||||
|
{ |
||||||
|
return testResult; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,117 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-06-18 |
||||||
|
* Time: 13:31 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of MSpecTestFramework.
|
||||||
|
/// </summary>
|
||||||
|
public class MSpecTestFramework : ITestFramework |
||||||
|
{ |
||||||
|
public bool IsTestMember(IMember member) { |
||||||
|
return member is IField |
||||||
|
&& HasItReturnType(member as IField); |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsTestClass(IClass c) { |
||||||
|
return HasSpecificationMembers(c) && !HasBehaviorAttribute(c); |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<TestMember> GetTestMembersFor(IClass @class) { |
||||||
|
return GetTestMembers(@class, @class.Fields); |
||||||
|
} |
||||||
|
|
||||||
|
private IEnumerable<TestMember> GetTestMembers(IClass testClass, IList<IField> fields) |
||||||
|
{ |
||||||
|
var result = fields.Where(HasItReturnType).Select(field => new TestMember(field)).ToList(); |
||||||
|
foreach (var field in fields) |
||||||
|
if (HasBehavesLikeReturnType(field)) |
||||||
|
{ |
||||||
|
var behaviorFields = ResolveBehaviorFieldsOf(field); |
||||||
|
var behaviorMembers = behaviorFields.Where(HasItReturnType); |
||||||
|
var testMembersFromBehavior = behaviorMembers.Select(testField => |
||||||
|
new TestMember(testField.DeclaringType, new BehaviorImportedTestMember(testClass, testField))); |
||||||
|
result.AddRange(testMembersFromBehavior); |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsTestProject(IProject project) { |
||||||
|
if (project != null) { |
||||||
|
foreach (ProjectItem item in project.Items) |
||||||
|
if (IsMSpecAssemblyReference(item)) |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public ITestRunner CreateTestRunner() { |
||||||
|
return new MSpecTestRunner(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public ITestRunner CreateTestDebugger() { |
||||||
|
return new MSpecTestDebugger(); |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsBuildNeededBeforeTestRun { |
||||||
|
get {return true;} |
||||||
|
} |
||||||
|
|
||||||
|
private IList<IField> ResolveBehaviorFieldsOf(IField field) |
||||||
|
{ |
||||||
|
var fieldReturnType = field.ReturnType.CastToConstructedReturnType(); |
||||||
|
if (fieldReturnType == null) return new List<IField>(); |
||||||
|
if (fieldReturnType.TypeArguments.Count != 1) |
||||||
|
LoggingService.Error(string.Format("Expected behavior specification {0} to have one type argument but {1} found.", field.FullyQualifiedName, fieldReturnType.TypeArgumentCount)); |
||||||
|
var behaviorClassType = fieldReturnType.TypeArguments.FirstOrDefault(); |
||||||
|
|
||||||
|
return behaviorClassType != null ? behaviorClassType.GetFields() : new List<IField>(); |
||||||
|
} |
||||||
|
|
||||||
|
private bool HasSpecificationMembers(IClass c) { |
||||||
|
return !c.IsAbstract |
||||||
|
&& c.Fields.Any(f => HasItReturnType(f) || HasBehavesLikeReturnType(f)); |
||||||
|
} |
||||||
|
|
||||||
|
private bool HasBehavesLikeReturnType(IField field) { |
||||||
|
return MSpecBehavesLikeFQName.Equals(field.ReturnType.FullyQualifiedName); |
||||||
|
} |
||||||
|
|
||||||
|
private bool HasItReturnType(IField field) { |
||||||
|
return MSpecItFQName.Equals(field.ReturnType.FullyQualifiedName); |
||||||
|
} |
||||||
|
|
||||||
|
private bool HasBehaviorAttribute(IClass c) { |
||||||
|
return c.Attributes.Any( |
||||||
|
attribute => MSpecBehaviorsAttributeFQName.Equals(attribute.AttributeType.FullyQualifiedName)); |
||||||
|
} |
||||||
|
|
||||||
|
private bool IsMSpecAssemblyReference(ProjectItem projectItem) { |
||||||
|
if (projectItem is ReferenceProjectItem) { |
||||||
|
ReferenceProjectItem refProjectItem = projectItem as ReferenceProjectItem; |
||||||
|
string name = refProjectItem.ShortName; |
||||||
|
return MSpecAssemblyName.Equals(name, StringComparison.OrdinalIgnoreCase); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
const string MSpecAssemblyName = "Machine.Specifications"; |
||||||
|
const string MSpecItFQName = MSpecAssemblyName + ".It"; |
||||||
|
const string MSpecBehavesLikeFQName = MSpecAssemblyName + ".Behaves_like"; |
||||||
|
const string MSpecBehaviorsAttributeFQName = MSpecAssemblyName + ".BehaviorsAttribute"; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,137 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using System.Xml; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
public class MSpecUnitTestMonitor : ITestResultsMonitor |
||||||
|
{ |
||||||
|
public event TestFinishedEventHandler TestFinished; |
||||||
|
private FileSystemWatcher fileSystemWatcher; |
||||||
|
private ISet<string> reportedResults; |
||||||
|
|
||||||
|
public MSpecUnitTestMonitor() |
||||||
|
{ |
||||||
|
FileName = Path.GetTempFileName(); |
||||||
|
} |
||||||
|
|
||||||
|
public string FileName { get; set; } |
||||||
|
|
||||||
|
public void Stop() |
||||||
|
{ |
||||||
|
if (fileSystemWatcher != null) |
||||||
|
{ |
||||||
|
fileSystemWatcher.Dispose(); |
||||||
|
fileSystemWatcher = null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Start() |
||||||
|
{ |
||||||
|
fileSystemWatcher = new FileSystemWatcher(Path.GetDirectoryName(FileName), Path.GetFileName(FileName)); |
||||||
|
reportedResults = new HashSet<string>(); |
||||||
|
if (File.Exists(FileName)) |
||||||
|
{ |
||||||
|
fileSystemWatcher.NotifyFilter = NotifyFilters.LastWrite; |
||||||
|
fileSystemWatcher.Changed += ObservedFileChanged; |
||||||
|
} else |
||||||
|
fileSystemWatcher.Created += ObservedFileCreated; |
||||||
|
fileSystemWatcher.Error += FileObservationError; |
||||||
|
fileSystemWatcher.EnableRaisingEvents = true; |
||||||
|
} |
||||||
|
|
||||||
|
void FileObservationError(object sender, ErrorEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Error("Error while waiting for unit test session report modification.", e.GetException()); |
||||||
|
} |
||||||
|
|
||||||
|
void ObservedFileCreated(object sender, FileSystemEventArgs e) |
||||||
|
{ |
||||||
|
fileSystemWatcher.Created -= ObservedFileCreated; |
||||||
|
fileSystemWatcher.NotifyFilter = NotifyFilters.LastWrite; |
||||||
|
fileSystemWatcher.Changed += ObservedFileChanged; |
||||||
|
} |
||||||
|
|
||||||
|
void ObservedFileChanged(object sender, FileSystemEventArgs e) |
||||||
|
{ |
||||||
|
Read(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Read() |
||||||
|
{ |
||||||
|
var document = new XmlDocument(); |
||||||
|
try |
||||||
|
{ |
||||||
|
document.Load(FileName); |
||||||
|
} |
||||||
|
catch (XmlException e) |
||||||
|
{ |
||||||
|
LoggingService.Warn("Error reading Machine.Specifications test results.", e); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
var contextNodes = document.SelectNodes("MSpec/assembly/concern/context/specification"); |
||||||
|
var results = contextNodes.Cast<XmlNode>().Select(BuildTestResultFrom).ToArray(); |
||||||
|
PublishTestResults(results); |
||||||
|
} |
||||||
|
|
||||||
|
TestResult BuildTestResultFrom(XmlNode node) |
||||||
|
{ |
||||||
|
var className = node.SelectSingleNode("../@type-name").InnerText; |
||||||
|
var result = new TestResult(className + "." + node.Attributes["field-name"].InnerText); |
||||||
|
switch (node.Attributes["status"].InnerText) |
||||||
|
{ |
||||||
|
case "failed": |
||||||
|
result.ResultType = TestResultType.Failure; |
||||||
|
break; |
||||||
|
case "passed": |
||||||
|
result.ResultType = TestResultType.Success; |
||||||
|
break; |
||||||
|
case "not-implemented": |
||||||
|
case "ignored": |
||||||
|
result.ResultType = TestResultType.Ignored; |
||||||
|
break; |
||||||
|
} |
||||||
|
var errorNode = node.SelectSingleNode("error"); |
||||||
|
if (errorNode != null) |
||||||
|
{ |
||||||
|
var messageNode = errorNode.SelectSingleNode("message"); |
||||||
|
result.Message = messageNode.InnerText; |
||||||
|
|
||||||
|
var stackTraceNode = errorNode.SelectSingleNode("stack-trace"); |
||||||
|
result.StackTrace = stackTraceNode.InnerText; |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
void PublishTestResults(TestResult[] testResults) |
||||||
|
{ |
||||||
|
if (TestFinished != null) |
||||||
|
foreach (var result in testResults) |
||||||
|
if (!reportedResults.Contains(result.Name)) { |
||||||
|
TestFinished(this, new TestFinishedEventArgs(result)); |
||||||
|
reportedResults.Add(result.Name); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public long InitialFilePosition { get; set; } |
||||||
|
|
||||||
|
public void Dispose() |
||||||
|
{ |
||||||
|
Stop(); |
||||||
|
try |
||||||
|
{ |
||||||
|
File.Delete(FileName); |
||||||
|
} |
||||||
|
catch (Exception e) |
||||||
|
{ |
||||||
|
LoggingService.Warn("Could delete temporary file.", e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-06-18 |
||||||
|
* Time: 14:01 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
namespace ICSharpCode.MachineSpecifications |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of MspecTestRunner.
|
||||||
|
/// </summary>
|
||||||
|
public class MSpecTestRunner : TestProcessRunnerBase |
||||||
|
{ |
||||||
|
public MSpecTestRunner() |
||||||
|
: base(new UnitTestProcessRunner(), new MSpecUnitTestMonitor(), new UnitTestFileService(), new UnitTestMessageService()) |
||||||
|
{ } |
||||||
|
|
||||||
|
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) |
||||||
|
{ |
||||||
|
var app = new MSpecApplication(selectedTests); |
||||||
|
app.Results = TestResultsMonitor.FileName; |
||||||
|
return app.GetProcessStartInfo(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override TestResult CreateTestResultForTestFramework(TestResult testResult) |
||||||
|
{ |
||||||
|
return testResult; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,71 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
|
||||||
|
namespace ICSharpCode.UnitTesting |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a test member that exists in a base class.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// In order to have the Unit Test tree run the correct
|
||||||
|
/// test when we have a class that has a base class with
|
||||||
|
/// test members is to return the derived class from the
|
||||||
|
/// DeclaringType's property. Otherwise the base class
|
||||||
|
/// member is tested and the derived class is not used.
|
||||||
|
/// </remarks>
|
||||||
|
public class BaseTestMember : AbstractMember |
||||||
|
{ |
||||||
|
IMember member; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the BaseTestMember.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="derivedClass">The derived class and not
|
||||||
|
/// the class where the method is actually defined.</param>
|
||||||
|
/// <param name="method">The base class's test member.</param>
|
||||||
|
public BaseTestMember(IClass derivedClass, IMember member) |
||||||
|
: this(derivedClass, member, member.DeclaringType.Name + "." + member.Name) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected BaseTestMember(IClass derivedClass, IMember member, string name) |
||||||
|
: base(derivedClass, name) |
||||||
|
{ |
||||||
|
this.member = member; |
||||||
|
this.ReturnType = member.ReturnType; |
||||||
|
this.Modifiers = member.Modifiers; |
||||||
|
this.Region = member.Region; |
||||||
|
this.BodyRegion = member.BodyRegion; |
||||||
|
this.Documentation = member.Documentation; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the actual method used to create this object.
|
||||||
|
/// </summary>
|
||||||
|
public IMember Member { |
||||||
|
get { return member; } |
||||||
|
} |
||||||
|
|
||||||
|
public override EntityType EntityType { |
||||||
|
get { |
||||||
|
return member.EntityType; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string DocumentationTag { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string Documentation {get;set;} |
||||||
|
|
||||||
|
public override IMember Clone() |
||||||
|
{ |
||||||
|
return new BaseTestMember(DeclaringType, Member); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,42 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using ICSharpCode.SharpDevelop.Dom; |
|
||||||
|
|
||||||
namespace ICSharpCode.UnitTesting |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Represents a test method that exists in a base class.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// In order to have the Unit Test tree run the correct
|
|
||||||
/// test when we have a class that has a base class with
|
|
||||||
/// test methods is to return the derived class from the
|
|
||||||
/// DeclaringType's property. Otherwise the base class
|
|
||||||
/// method is tested and the derived class is not used.
|
|
||||||
/// </remarks>
|
|
||||||
public class BaseTestMethod : DefaultMethod |
|
||||||
{ |
|
||||||
IMethod method; |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of the BaseTestMethod.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="derivedClass">The derived class and not
|
|
||||||
/// the class where the method is actually defined.</param>
|
|
||||||
/// <param name="method">The base class's test method.</param>
|
|
||||||
public BaseTestMethod(IClass derivedClass, IMethod method) |
|
||||||
: base(method.Name, method.ReturnType, method.Modifiers, method.Region, method.BodyRegion, derivedClass) |
|
||||||
{ |
|
||||||
this.method = method; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the actual method used to create this object.
|
|
||||||
/// </summary>
|
|
||||||
public IMethod Method { |
|
||||||
get { return method; } |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -0,0 +1,47 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
|
||||||
|
namespace ICSharpCode.UnitTesting |
||||||
|
{ |
||||||
|
public class InnerClassEnumerator : IEnumerable<IClass> |
||||||
|
{ |
||||||
|
readonly IClass _c; |
||||||
|
|
||||||
|
public InnerClassEnumerator(IClass c) |
||||||
|
{ |
||||||
|
_c = c; |
||||||
|
} |
||||||
|
|
||||||
|
#region IEnumerable<IClass> Members
|
||||||
|
|
||||||
|
public IEnumerator<IClass> GetEnumerator() |
||||||
|
{ |
||||||
|
var result = new List<IClass>(); |
||||||
|
Visit(_c, result); |
||||||
|
return result.GetEnumerator(); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IEnumerable Members
|
||||||
|
|
||||||
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||||
|
{ |
||||||
|
return GetEnumerator(); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void Visit(IClass c, List<IClass> resultList) |
||||||
|
{ |
||||||
|
foreach (var innerClass in c.InnerClasses) |
||||||
|
{ |
||||||
|
resultList.Add(innerClass); |
||||||
|
Visit(innerClass, resultList); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.UnitTesting |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a method that has the [Test] attribute associated with it.
|
||||||
|
/// </summary>
|
||||||
|
public class TestMethodTreeNode : TestTreeNode |
||||||
|
{ |
||||||
|
TestMethod testMethod; |
||||||
|
|
||||||
|
public TestMethodTreeNode(TestProject project, TestMethod testMethod) |
||||||
|
: base(project, testMethod.Name) |
||||||
|
{ |
||||||
|
this.testMethod = testMethod; |
||||||
|
testMethod.ResultChanged += TestMethodResultChanged; |
||||||
|
UpdateImageListIndex(testMethod.Result); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the underlying IMethod for this test method.
|
||||||
|
/// </summary>
|
||||||
|
public IMember Method { |
||||||
|
get { |
||||||
|
return testMethod.Method; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the TestMethod.ResultChanged event handler.
|
||||||
|
/// </summary>
|
||||||
|
public override void Dispose() |
||||||
|
{ |
||||||
|
if (!IsDisposed) { |
||||||
|
testMethod.ResultChanged -= TestMethodResultChanged; |
||||||
|
} |
||||||
|
base.Dispose(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the node's icon after the test method result
|
||||||
|
/// has changed.
|
||||||
|
/// </summary>
|
||||||
|
void TestMethodResultChanged(object source, EventArgs e) |
||||||
|
{ |
||||||
|
UpdateImageListIndex(testMethod.Result); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,294 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using NUnit.Framework; |
||||||
|
using UnitTesting.Tests.Utils; |
||||||
|
|
||||||
|
namespace UnitTesting.Tests.Frameworks |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class RegisteredTestFrameworksTestFixture |
||||||
|
{ |
||||||
|
RegisteredTestFrameworks testFrameworks; |
||||||
|
MockTestFramework nunitTestFramework; |
||||||
|
MockTestFramework mbUnitTestFramework; |
||||||
|
MockCSharpProject project; |
||||||
|
MockMethod method; |
||||||
|
MockClass clazz; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
List<TestFrameworkDescriptor> descriptors = new List<TestFrameworkDescriptor>(); |
||||||
|
|
||||||
|
MockTestFrameworkFactory factory = new MockTestFrameworkFactory(); |
||||||
|
|
||||||
|
Properties mbUnitProperties = new Properties(); |
||||||
|
mbUnitProperties["id"] = "mbunit"; |
||||||
|
mbUnitProperties["class"] = "MBUnitTestFramework"; |
||||||
|
mbUnitProperties["supportedProjects"] = ".vbproj"; |
||||||
|
mbUnitTestFramework = new MockTestFramework(); |
||||||
|
factory.Add("MBUnitTestFramework", mbUnitTestFramework); |
||||||
|
|
||||||
|
Properties nunitProperties = new Properties(); |
||||||
|
nunitProperties["id"] = "nunit"; |
||||||
|
nunitProperties["class"] = "NUnitTestFramework"; |
||||||
|
nunitProperties["supportedProjects"] = ".csproj"; |
||||||
|
nunitTestFramework = new MockTestFramework(); |
||||||
|
factory.Add("NUnitTestFramework", nunitTestFramework); |
||||||
|
|
||||||
|
TestFrameworkDescriptor mbUnitDescriptor = new TestFrameworkDescriptor(mbUnitProperties, factory); |
||||||
|
TestFrameworkDescriptor nunitDescriptor = new TestFrameworkDescriptor(nunitProperties, factory); |
||||||
|
|
||||||
|
descriptors.Add(mbUnitDescriptor); |
||||||
|
descriptors.Add(nunitDescriptor); |
||||||
|
|
||||||
|
MockAddInTree addinTree = new MockAddInTree(); |
||||||
|
addinTree.AddItems("/SharpDevelop/UnitTesting/TestFrameworks", descriptors); |
||||||
|
|
||||||
|
testFrameworks = new RegisteredTestFrameworks(addinTree); |
||||||
|
|
||||||
|
project = new MockCSharpProject(); |
||||||
|
nunitTestFramework.AddTestProject(project); |
||||||
|
mbUnitTestFramework.AddTestProject(project); |
||||||
|
|
||||||
|
method = MockMethod.CreateMockMethodWithoutAnyAttributes(); |
||||||
|
method.MockDeclaringType.MockProjectContent.Project = project; |
||||||
|
|
||||||
|
clazz = MockClass.CreateMockClassWithoutAnyAttributes(); |
||||||
|
clazz.MockProjectContent.Project = project; |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void NUnitTestFrameworkRegisteredForUseWithProjectsWithCSharpProjectFileExtension() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test\MyProj.csproj"; |
||||||
|
|
||||||
|
Assert.AreEqual(nunitTestFramework, testFrameworks.GetTestFrameworkForProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MbUnitTestFrameworkRegisteredForUseWithProjectsWithVBNetProjectFileExtension() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test\MyProj.vbproj"; |
||||||
|
|
||||||
|
Assert.AreEqual(mbUnitTestFramework, testFrameworks.GetTestFrameworkForProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestMethodReturnsFalseForUnknownMbUnitFrameworkTestMethod() |
||||||
|
{ |
||||||
|
method.MockDeclaringType.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestMethod(method)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestMethodReturnsTrueForKnownMbUnitFrameworkTestMethod() |
||||||
|
{ |
||||||
|
method.MockDeclaringType.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
mbUnitTestFramework.AddTestMethod(method); |
||||||
|
|
||||||
|
Assert.IsTrue(testFrameworks.IsTestMethod(method)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestMethodDoesNotThrowNullReferenceExceptionWhenNoTestFrameworkSupportsProject() |
||||||
|
{ |
||||||
|
method.MockDeclaringType.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.unknown"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestMethod(method)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestMethodDoesNotThrowNullReferenceWhenNullPassedToMethod() |
||||||
|
{ |
||||||
|
Assert.IsFalse(testFrameworks.IsTestMethod(null)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestClassReturnsFalseForUnknownMbUnitFrameworkTestClass() |
||||||
|
{ |
||||||
|
clazz.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestClass(clazz)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestClassReturnsTrueForKnownMbUnitFrameworkTestClass() |
||||||
|
{ |
||||||
|
clazz.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
mbUnitTestFramework.AddTestClass(clazz); |
||||||
|
|
||||||
|
Assert.IsTrue(testFrameworks.IsTestClass(clazz)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestClassDoesNotThrowNullReferenceExceptionWhenNoTestFrameworkSupportsProject() |
||||||
|
{ |
||||||
|
clazz.MockProjectContent.ProjectAsIProject.FileName = @"d:\projects\test.unknown"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestClass(clazz)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestClassDoesNotThrowNullReferenceWhenNullPassedToMethod() |
||||||
|
{ |
||||||
|
Assert.IsFalse(testFrameworks.IsTestClass(null)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestProjectReturnsFalseForUnknownMbUnitFrameworkTestProject() |
||||||
|
{ |
||||||
|
project = new MockCSharpProject(); |
||||||
|
project.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestProjectReturnsTrueForKnownMbUnitFrameworkTestProject() |
||||||
|
{ |
||||||
|
project = new MockCSharpProject(); |
||||||
|
project.FileName = @"d:\projects\test.vbproj"; |
||||||
|
|
||||||
|
mbUnitTestFramework.AddTestProject(project); |
||||||
|
|
||||||
|
Assert.IsTrue(testFrameworks.IsTestProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestProjectDoesNotThrowNullReferenceExceptionWhenNoTestFrameworkSupportsProject() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.unknown"; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsTestProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsTestProjectDoesNotThrowNullReferenceWhenNullPassedToMethod() |
||||||
|
{ |
||||||
|
Assert.IsFalse(testFrameworks.IsTestProject(null)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CreateTestRunnerReturnsNewTestRunnerFromCorrectTestFramework() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.csproj"; |
||||||
|
|
||||||
|
ITestRunner testRunner = testFrameworks.CreateTestRunner(project); |
||||||
|
ITestRunner[] expectedTestRunners = new ITestRunner[] { testRunner }; |
||||||
|
Assert.AreEqual(expectedTestRunners, nunitTestFramework.TestRunnersCreated.ToArray()); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CreateTestRunnerDoesNotThrowNullRefExceptionWhenUnknownProjectPassedToCreateTestRunnerMethod() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.unknown"; |
||||||
|
|
||||||
|
Assert.IsNull(testFrameworks.CreateTestRunner(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CreateTestDebuggerReturnsNewTestRunnerFromCorrectTestFramework() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.csproj"; |
||||||
|
|
||||||
|
ITestRunner testDebugger = testFrameworks.CreateTestDebugger(project); |
||||||
|
ITestRunner[] expectedTestRunners = new ITestRunner[] { testDebugger }; |
||||||
|
Assert.AreEqual(expectedTestRunners, nunitTestFramework.TestDebuggersCreated.ToArray()); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CreateTestDebuggerDoesNotThrowNullRefExceptionWhenUnknownProjectPassedToCreateTestRunnerMethod() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.unknown"; |
||||||
|
|
||||||
|
Assert.IsNull(testFrameworks.CreateTestDebugger(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsBuildNeededBeforeTestRunReturnsTrueWhenTestFrameworkIsBuildNeededBeforeTestRunSetToTrue() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.csproj"; |
||||||
|
nunitTestFramework.IsBuildNeededBeforeTestRun = true; |
||||||
|
|
||||||
|
Assert.IsTrue(testFrameworks.IsBuildNeededBeforeTestRunForProject(project)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void IsBuildNeededBeforeTestRunReturnsFalseWhenTestFrameworkIsBuildNeededBeforeTestRunSetToFalse() |
||||||
|
{ |
||||||
|
project.FileName = @"d:\projects\test.csproj"; |
||||||
|
nunitTestFramework.IsBuildNeededBeforeTestRun = false; |
||||||
|
|
||||||
|
Assert.IsFalse(testFrameworks.IsBuildNeededBeforeTestRunForProject(project)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[TestFixture] |
||||||
|
public class RegisteredTestFrameworksWithTwoFrameworksForTheSameProjectType |
||||||
|
{ |
||||||
|
MockCSharpProject nunitTestProject; |
||||||
|
MockTestFramework nunitTestFramework; |
||||||
|
MockCSharpProject mspecTestProject; |
||||||
|
MockTestFramework mspecTestFramework; |
||||||
|
RegisteredTestFrameworks testFrameworks; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Setup() |
||||||
|
{ |
||||||
|
var factory = new MockTestFrameworkFactory(); |
||||||
|
|
||||||
|
Properties nunitProperties = new Properties(); |
||||||
|
nunitProperties["id"] = "nunit"; |
||||||
|
nunitProperties["class"] = "NUnitTestFramework"; |
||||||
|
nunitProperties["supportedProjects"] = ".csproj"; |
||||||
|
nunitTestFramework = new MockTestFramework(); |
||||||
|
factory.Add("NUnitTestFramework", nunitTestFramework); |
||||||
|
|
||||||
|
var mspecProperties = new Properties(); |
||||||
|
mspecProperties["id"] = "mspec"; |
||||||
|
mspecProperties["class"] = "MSpecTestFramework"; |
||||||
|
mspecProperties["supportedProjects"] = ".csproj"; |
||||||
|
mspecTestFramework = new MockTestFramework(); |
||||||
|
factory.Add("MSpecTestFramework", mspecTestFramework); |
||||||
|
|
||||||
|
TestFrameworkDescriptor mspecDescriptor = new TestFrameworkDescriptor(mspecProperties, factory); |
||||||
|
TestFrameworkDescriptor nunitDescriptor = new TestFrameworkDescriptor(nunitProperties, factory); |
||||||
|
|
||||||
|
var descriptors = new List<TestFrameworkDescriptor> { mspecDescriptor, nunitDescriptor }; |
||||||
|
|
||||||
|
MockAddInTree addinTree = new MockAddInTree(); |
||||||
|
addinTree.AddItems("/SharpDevelop/UnitTesting/TestFrameworks", descriptors); |
||||||
|
|
||||||
|
testFrameworks = new RegisteredTestFrameworks(addinTree); |
||||||
|
|
||||||
|
nunitTestProject = new MockCSharpProject(); |
||||||
|
nunitTestProject.FileName = @"d:\projects\nunitTestProject.csproj"; |
||||||
|
nunitTestFramework.AddTestProject(nunitTestProject); |
||||||
|
|
||||||
|
mspecTestProject = new MockCSharpProject(); |
||||||
|
mspecTestProject.FileName = @"d:\projects\mspecTestProject.csproj"; |
||||||
|
mspecTestFramework.AddTestProject(mspecTestProject); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ItShouldReturnMSpecTestFrameworkForMSpecTestProject() |
||||||
|
{ |
||||||
|
Assert.AreSame(mspecTestFramework, testFrameworks.GetTestFrameworkForProject(mspecTestProject), "Expected mspec test framework."); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ItShouldReturnNUnitTestFrameworkForNUnitTestProject() |
||||||
|
{ |
||||||
|
Assert.AreSame(nunitTestFramework, testFrameworks.GetTestFrameworkForProject(nunitTestProject), "Expected nunit test framework."); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,74 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: trecio |
||||||
|
* Date: 2011-10-23 |
||||||
|
* Time: 16:15 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Linq; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using NUnit.Framework; |
||||||
|
using UnitTesting.Tests.Utils; |
||||||
|
|
||||||
|
namespace UnitTesting.Tests.Project |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that a class with base type nested inside test fixture is recognized, e.g.
|
||||||
|
///
|
||||||
|
/// public abstract class BaseClass {
|
||||||
|
/// [Test]
|
||||||
|
/// public void BaseFoo() {
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// [TestFixture]
|
||||||
|
/// public class A
|
||||||
|
/// {
|
||||||
|
/// public class InnerATest
|
||||||
|
/// {
|
||||||
|
/// [Test]
|
||||||
|
/// public void FooBar()
|
||||||
|
/// {
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// public class InnerTestLevel2 : BaseClass {
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class DoubleNestedTestClassWithBaseType : InnerClassTestFixtureBase |
||||||
|
{ |
||||||
|
MockClass classNestedInInnerClass; |
||||||
|
MockClass baseClass; |
||||||
|
MockMethod testMethodInBaseClass; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void SetUp() { |
||||||
|
base.InitBase(); |
||||||
|
|
||||||
|
baseClass = new MockClass(projectContent, "MyTests.BaseClass"); |
||||||
|
testMethodInBaseClass = new MockMethod(baseClass, "BaseFoo"); |
||||||
|
testMethodInBaseClass.Attributes.Add(new MockAttribute("Test")); |
||||||
|
baseClass.Methods.Add(testMethodInBaseClass); |
||||||
|
|
||||||
|
//Add TestFixture attribute to outer class
|
||||||
|
outerClass.Attributes.Add(new MockAttribute("TestFixture")); |
||||||
|
|
||||||
|
//Add inner class nested in test class
|
||||||
|
classNestedInInnerClass = new MockClass(projectContent, "MyTests.A.InnerATest.InnerTestLevel2", "MyTests.A+InnerATest+InnerTestLevel2", innerClass); |
||||||
|
innerClass.InnerClasses.Add(classNestedInInnerClass); |
||||||
|
classNestedInInnerClass.AddBaseClass(baseClass); |
||||||
|
|
||||||
|
testProject = new TestProject(null, projectContent, testFrameworks); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DoubleNestedClassShouldHaveTestMemberImportedFromBaseClass() { |
||||||
|
var nestedClass = testProject.TestClasses.Single(c => c.Class == classNestedInInnerClass); |
||||||
|
Assert.AreEqual("BaseClass.BaseFoo", nestedClass.TestMembers.Single().Name); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,110 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.UnitTesting; |
||||||
|
using NUnit.Framework; |
||||||
|
using UnitTesting.Tests.Utils; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace UnitTesting.Tests.Project |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that a class nested inside test fixture is recognized, e.g.
|
||||||
|
///
|
||||||
|
/// [TestFixture]
|
||||||
|
/// public class A
|
||||||
|
/// {
|
||||||
|
/// public class InnerATest
|
||||||
|
/// {
|
||||||
|
/// [Test]
|
||||||
|
/// public void FooBar()
|
||||||
|
/// {
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// [TestFixture]
|
||||||
|
/// public class InnerTestLevel2 {
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// public class InnerBClass() {}
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class InnerClassInTestFixtureTests : InnerClassTestFixtureBase |
||||||
|
{ |
||||||
|
MockClass classNestedInInnerClass; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
base.InitBase(); |
||||||
|
|
||||||
|
//Add TestFixture attribute to outer class
|
||||||
|
outerClass.Attributes.Add(new MockAttribute("TestFixture")); |
||||||
|
testProject = new TestProject(null, projectContent, testFrameworks); |
||||||
|
|
||||||
|
//Add inner class nested in test class
|
||||||
|
classNestedInInnerClass = new MockClass(projectContent, "MyTests.A.InnerATest.InnerTestLevel2", "MyTests.A+InnerATest+InnerTestLevel2", innerClass); |
||||||
|
classNestedInInnerClass.Attributes.Add(new MockAttribute("TestFixture")); |
||||||
|
innerClass.InnerClasses.Add(classNestedInInnerClass); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void OuterTestClassFound() |
||||||
|
{ |
||||||
|
AssertTestResultContainsClass(outerClass); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void InnerTestClassWithTestFixtureAttributeFound() |
||||||
|
{ |
||||||
|
AssertTestResultContainsClass(innerClass); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void InnerNonTestClassWithoutWasNotMarkedAsTestClass() |
||||||
|
{ |
||||||
|
AssertTestResultDoesNotContainClass(nonTestInnerClass); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void InnerClassInInnerClassFound() |
||||||
|
{ |
||||||
|
AssertTestResultContainsClass(classNestedInInnerClass); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void TestClassNameShouldBeDotNetNameOfTheDoubleNestedClass() |
||||||
|
{ |
||||||
|
Assert.AreEqual("A+InnerATest+InnerTestLevel2", TestClassRelatedTo(classNestedInInnerClass).Name); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void TestClassNamespaceShouldBeValid() |
||||||
|
{ |
||||||
|
Assert.AreEqual("MyTests", TestClassRelatedTo(classNestedInInnerClass).Namespace); |
||||||
|
} |
||||||
|
|
||||||
|
void AssertTestResultContainsClass(IClass clazz) |
||||||
|
{ |
||||||
|
var testClazz = TestClassRelatedTo(clazz); |
||||||
|
if (testClazz == null) |
||||||
|
throw new AssertionException(string.Format("Test result should contain class {0}.", clazz.FullyQualifiedName)); |
||||||
|
} |
||||||
|
|
||||||
|
void AssertTestResultDoesNotContainClass(MockClass clazz) |
||||||
|
{ |
||||||
|
var testClazz = TestClassRelatedTo(clazz); |
||||||
|
if (testClazz != null) |
||||||
|
throw new AssertionException(string.Format("Test result should not contain class {0}.", clazz.FullyQualifiedName)); |
||||||
|
} |
||||||
|
|
||||||
|
TestClass TestClassRelatedTo(IClass clazz) |
||||||
|
{ |
||||||
|
return testProject.TestClasses.SingleOrDefault(c => c.Class == clazz); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Binary file not shown.
@ -0,0 +1,54 @@ |
|||||||
|
Copyright (c) 2008 Machine Project |
||||||
|
Portions Copyright (c) 2008 Jacob Lewallen, Aaron Jensen |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
of this software and associated documentation files (the "Software"), to deal |
||||||
|
in the Software without restriction, including without limitation the rights |
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
copies of the Software, and to permit persons to whom the Software is |
||||||
|
furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in |
||||||
|
all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||||
|
THE SOFTWARE. |
||||||
|
|
||||||
|
***************************** |
||||||
|
Some parts licensed under MS-PL |
||||||
|
***************************** |
||||||
|
|
||||||
|
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. |
||||||
|
|
||||||
|
1. Definitions |
||||||
|
|
||||||
|
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. |
||||||
|
|
||||||
|
A "contribution" is the original software, or any additions or changes to the software. |
||||||
|
|
||||||
|
A "contributor" is any person that distributes its contribution under this license. |
||||||
|
|
||||||
|
"Licensed patents" are a contributor's patent claims that read directly on its contribution. |
||||||
|
|
||||||
|
2. Grant of Rights |
||||||
|
|
||||||
|
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. |
||||||
|
|
||||||
|
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. |
||||||
|
|
||||||
|
3. Conditions and Limitations |
||||||
|
|
||||||
|
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. |
||||||
|
|
||||||
|
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. |
||||||
|
|
||||||
|
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. |
||||||
|
|
||||||
|
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. |
||||||
|
|
||||||
|
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. |
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue