From 9d5dee2c656b69e0d7b7129ccecd1f651212bdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 3 Aug 2015 13:47:12 +0200 Subject: [PATCH 1/2] Changed NUnitDomainModel to be in line with documentation. --- src/app/FakeLib/UnitTest/NUnit/Common.fs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/FakeLib/UnitTest/NUnit/Common.fs b/src/app/FakeLib/UnitTest/NUnit/Common.fs index d08e692a14c..da6eba0b277 100644 --- a/src/app/FakeLib/UnitTest/NUnit/Common.fs +++ b/src/app/FakeLib/UnitTest/NUnit/Common.fs @@ -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" @@ -136,7 +139,7 @@ let NUnitDefaults = XsltTransformFile = "" TimeOut = TimeSpan.FromMinutes 5.0 DisableShadowCopy = false - Domain = SingleDomainModel + Domain = DefaultDomainModel ErrorLevel = Error Fixture = ""} From b7e14b8ea7cc5759547ed7907251351b62cf7b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 3 Aug 2015 13:47:47 +0200 Subject: [PATCH 2/2] Added tests to verify argument generation for NUnitDomainModel --- src/test/Test.FAKECore/NunitCommonSpecs.cs | 90 +++++++++++++++++++++ src/test/Test.FAKECore/Test.FAKECore.csproj | 1 + 2 files changed, 91 insertions(+) create mode 100644 src/test/Test.FAKECore/NunitCommonSpecs.cs diff --git a/src/test/Test.FAKECore/NunitCommonSpecs.cs b/src/test/Test.FAKECore/NunitCommonSpecs.cs new file mode 100644 index 00000000000..2c867621b2b --- /dev/null +++ b/src/test/Test.FAKECore/NunitCommonSpecs.cs @@ -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"); + } +} \ No newline at end of file diff --git a/src/test/Test.FAKECore/Test.FAKECore.csproj b/src/test/Test.FAKECore/Test.FAKECore.csproj index 75ad1ec7a76..01f9f5db03a 100644 --- a/src/test/Test.FAKECore/Test.FAKECore.csproj +++ b/src/test/Test.FAKECore/Test.FAKECore.csproj @@ -84,6 +84,7 @@ +