Skip to content

Commit

Permalink
Merge pull request #897 from andersosthus/nunitdomainmodel
Browse files Browse the repository at this point in the history
Align NUnitDomainModel with NUnit documentation
  • Loading branch information
forki committed Aug 3, 2015
2 parents 5fa687a + b7e14b8 commit e8858ca
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/FakeLib/UnitTest/NUnit/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ type NUnitProcessModel =
| MultipleProcessModel -> "Multiple"
/// The /domain option controls of the creation of AppDomains for running tests. See [NUnit-Console Command Line Options](http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.4)
type NUnitDomainModel =
/// No domain is created - the tests are run in the primary domain. This normally requires copying the NUnit assemblies into the same directory as your tests.
/// The default is to use multiple domains if multiple assemblies are listed on the command line. Otherwise a single domain is used.
| DefaultDomainModel
/// No domain is created - the tests are run in the primary domain. This normally requires copying the NUnit assemblies into the same directory as your tests.
| NoDomainModel
/// A test domain is created - this is how NUnit worked prior to version 2.4
| SingleDomainModel
/// A separate test domain is created for each assembly
| MultipleDomainModel with
member x.ParamString =
match x with
| DefaultDomainModel -> "None"
| DefaultDomainModel -> ""
| NoDomainModel -> "None"
| SingleDomainModel -> "Single"
| MultipleDomainModel -> "Multiple"

Expand Down Expand Up @@ -136,7 +139,7 @@ let NUnitDefaults =
XsltTransformFile = ""
TimeOut = TimeSpan.FromMinutes 5.0
DisableShadowCopy = false
Domain = SingleDomainModel
Domain = DefaultDomainModel
ErrorLevel = Error
Fixture = ""}

Expand Down
90 changes: 90 additions & 0 deletions src/test/Test.FAKECore/NunitCommonSpecs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System;
using Fake;
using FSharp.Testing;
using Machine.Specifications;

namespace Test.FAKECore.NunitCommonSpecs
{
[Subject(typeof(NUnitCommon), "runner argument construction")]
internal abstract class BuildArgumentsSpecsBase
{
protected static NUnitCommon.NUnitParams Parameters;
protected static string[] Assemblies;
protected static string Arguments;

Establish context = () =>
{
Parameters = NUnitCommon.NUnitDefaults;
Assemblies = new[] { "test.dll", "other.dll" };
};

Because of = () =>
{
Arguments = NUnitCommon.buildNUnitdArgs(Parameters, Assemblies);
Console.WriteLine(Arguments);
};
}

internal class When_using_the_default_parameters
: BuildArgumentsSpecsBase
{
It should_not_disable_shadow_copy =
() => Arguments.ShouldNotContain("-noshadow");
It should_not_exclude_category =
() => Arguments.ShouldNotContain("-exclude:");
It should_not_include_category =
() => Arguments.ShouldNotContain("-include:");
It should_not_select_app_domain =
() => Arguments.ShouldNotContain("-domain:");
It should_not_show_logo =
() => Arguments.ShouldContain("-nologo");
It should_not_specify_error_out_file =
() => Arguments.ShouldNotContain("-err:");
It should_not_specify_fixture =
() => Arguments.ShouldNotContain("-fixture:");
It should_not_specify_framework =
() => Arguments.ShouldNotContain("-framework:");
It should_not_specify_out_file =
() => Arguments.ShouldNotContain("-out:");
It should_not_specify_process_model =
() => Arguments.ShouldNotContain("-process:");
It should_not_specify_xslt_transform_file =
() => Arguments.ShouldNotContain("-transform:");
It should_not_stop_on_error =
() => Arguments.ShouldNotContain("-stoponerror");
It should_not_test_in_new_thread =
() => Arguments.ShouldNotContain("-nothread");
It should_show_labels =
() => Arguments.ShouldContain("-labels");
}

internal class When_requesting_no_app_domain
: BuildArgumentsSpecsBase
{
Establish context =
() => Parameters = Parameters.With(p => p.Domain, NUnitCommon.NUnitDomainModel.NoDomainModel);

It should_request_no_app_domain =
() => Arguments.ShouldContain("-domain:None");
}

internal class When_requesting_single_app_domain
: BuildArgumentsSpecsBase
{
Establish context =
() => Parameters = Parameters.With(p => p.Domain, NUnitCommon.NUnitDomainModel.SingleDomainModel);

It should_request_single_app_domain =
() => Arguments.ShouldContain("-domain:Single");
}

internal class When_requesting_multiple_app_domains
: BuildArgumentsSpecsBase
{
Establish context =
() => Parameters = Parameters.With(p => p.Domain, NUnitCommon.NUnitDomainModel.MultipleDomainModel);

It should_request_multiple_app_domains =
() => Arguments.ShouldContain("-domain:Multiple");
}
}
1 change: 1 addition & 0 deletions src/test/Test.FAKECore/Test.FAKECore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Compile Include="Globbing\TestSample5\AbsoluteDirGlobbingSpecs.cs" />
<Compile Include="NAVFiles\NAVSplitObjectSpecs.cs" />
<Compile Include="NAVFiles\NavTestResultSpecs.cs" />
<Compile Include="NunitCommonSpecs.cs" />
<Compile Include="OpenCoverHelperSpecs.cs" />
<Compile Include="PackageMgt\PackagesConfigSpecs.cs" />
<Compile Include="SemVerHelperSpecs.cs" />
Expand Down

0 comments on commit e8858ca

Please sign in to comment.