Beispiel #1
0
        public Either <Error, Memory> LoadMemory()
        {
            var memory = new TypeDictionary();
            var error  = new Error();

            var argumentParser = new ArgumentParser();

            argumentParser.AddArgumentHandler("c", value => {
                if (!textSource.Exists(value))
                {
                    error.Add($"Suite configuration file '{value}' does not exist.");
                }
                else
                {
                    new SuiteConfiguration(memory).LoadXml(textSource.Content(value));
                }
            });
            argumentParser.AddArgumentHandler("r", value => memory.GetItem <Settings>().Runner = value);
            argumentParser.AddArgumentHandler("f", InitializeAndAddFolders);
            argumentParser.Parse(commandLineArguments);

            memory.Item <Settings>().Apply(settings => ParseRunner(memory, settings));

            if (error.IsNone && string.IsNullOrEmpty(memory.GetItem <Settings>().Runner))
            {
                error.Add("Missing runner class");
            }

            return(new Either <Error, Memory>(!error.IsNone, error, memory));
        }
Beispiel #2
0
 public static Memory InitAssembliesAndNamespaces()
 {
     var memory = new TypeDictionary();
     memory.GetItem<ApplicationUnderTest>().AddAssembly(Assembly.GetAssembly(typeof (TestUtils)).CodeBase);
     memory.GetItem<ApplicationUnderTest>().AddNamespace("fit.Test.NUnit");
     memory.GetItem<ApplicationUnderTest>().AddNamespace("fit.Test.Acceptance");
     return memory;
 }
Beispiel #3
0
        public static Configuration InitAssembliesAndNamespaces()
        {
            var configuration = new TypeDictionary();

            configuration.GetItem <ApplicationUnderTest>().AddAssembly(Assembly.GetAssembly(typeof(TestUtils)).CodeBase);
            configuration.GetItem <ApplicationUnderTest>().AddNamespace("fit.Test.NUnit");
            configuration.GetItem <ApplicationUnderTest>().AddNamespace("fit.Test.Acceptance");
            return(configuration);
        }
Beispiel #4
0
        public static Memory InitAssembliesAndNamespaces()
        {
            var memory = new TypeDictionary();

            memory.GetItem <ApplicationUnderTest>().AddAssembly(Assembly.GetAssembly(typeof(TestUtils)).CodeBase);
            memory.GetItem <ApplicationUnderTest>().AddNamespace("fit.Test.NUnit");
            memory.GetItem <ApplicationUnderTest>().AddNamespace("fit.Test.Acceptance");
            return(memory);
        }
        [Test] public void CopyableChangesDontShowInCopy()
        {
            configuration.GetItem <FullTestConfig>().Data = "stuff";
            var copy = configuration.Copy();

            configuration.GetItem <FullTestConfig>().Data = "other";
            Assert.AreEqual("stuff", copy.GetItem <FullTestConfig>().Data);
            Assert.AreEqual("other", configuration.GetItem <FullTestConfig>().Data);
        }
Beispiel #6
0
 static void CheckResult(string content, string expected) {
     var folder = new FolderTestModel();
     var memory = new TypeDictionary();
     memory.GetItem<Settings>().OutputFolder = "output";
     var file = new StoryTestFile("myfile", new StoryTestFolder(memory, folder), folder);
     file.WriteTest(new PageResult("title", content, new TestCounts()));
     Assert.AreEqual(expected, folder.GetPageContent(new FilePath("output\\myfile.html")));
 }
Beispiel #7
0
        CellProcessorBase CreateProcessor()
        {
            var memory    = new TypeDictionary();
            var processor = new CellProcessorBase(memory, memory.GetItem <CellOperators>());

            processor.ApplicationUnderTest.AddAssemblies(assemblies);
            processor.AddNamespace("fitnesse.slim.test");
            namespaces.ToList().ForEach(processor.AddNamespace);
            return(processor);
        }
        StoryTestFile MakeStoryTestFile(string fileName)
        {
            folder.MakeFile(fileName, "stuff");
            var memory = new TypeDictionary();

            memory.GetItem <Settings>().OutputFolder = "output";
            var file = new StoryTestFile(fileName,
                                         new StoryTestFolder(memory, folder, new Filters(string.Empty, new FileExclusions(), string.Empty)), folder);

            return(file);
        }
Beispiel #9
0
        static void CheckResult(string content, string expected)
        {
            var folder = new FolderTestModel();
            var memory = new TypeDictionary();

            memory.GetItem <Settings>().OutputFolder = "output";
            var file = new StoryTestFile("myfile", new StoryTestFolder(memory, folder), folder);

            file.WriteTest(new PageResult("title", content, new TestCounts()));
            Assert.AreEqual(expected, folder.GetPageContent(new FilePath("output\\myfile.html")));
        }
Beispiel #10
0
 static void CheckResult(string content, string expected)
 {
     Clock.Instance = new TestClock {Now = new DateTime(2016, 1, 2, 13, 14, 15)};
     var folder = new FolderTestModel();
     var memory = new TypeDictionary();
     memory.GetItem<Settings>().OutputFolder = "output";
     var file = new StoryTestFile("myfile", new StoryTestFolder(memory, folder), folder);
     file.WriteTest(new PageResult("title", content, new TestCounts()));
     Clock.Instance = new Clock();
     Assert.AreEqual(comment + expected, folder.GetPageContent(new FilePath("output\\myfile.html")));
 }
Beispiel #11
0
        public Either <Error, Memory> LoadMemory()
        {
            var memory = new TypeDictionary();
            var error  = new Error();

            var argumentParser = new ArgumentParser();

//            argumentParser.AddArgumentHandler("a", value => memory.GetItem<AppDomainSetup>().ConfigurationFile = value);
            argumentParser.AddArgumentHandler("c", value => {
                if (!textSource.Exists(value))
                {
                    error.Add(string.Format("Suite configuration file '{0}' does not exist.", value));
                }
                else
                {
                    new SuiteConfiguration(memory).LoadXml(textSource.Content(value));
                }
            });
            argumentParser.AddArgumentHandler("r", value => memory.GetItem <Settings>().Runner = value);
            argumentParser.AddArgumentHandler("f", InitializeAndAddFolders);
            argumentParser.AddArgumentHandler("p", PauseForDebug);
            argumentParser.Parse(commandLineArguments);

            memory.Item <Settings>().Apply(settings => ParseRunner(memory, settings));

//            if (error.IsNone) {
//                memory.Item<AppDomainSetup>().Apply(setup => ValidateApplicationBase(setup, error));
//            }

            if (error.IsNone && string.IsNullOrEmpty(memory.GetItem <Settings>().Runner))
            {
                error.Add("Missing runner class");
            }

            return(new Either <Error, Memory>(!error.IsNone, error, memory));
        }
Beispiel #12
0
        static void CheckResult(string content, string expected)
        {
            Clock.Instance = new TestClock {
                Now = new DateTime(2016, 1, 2, 13, 14, 15)
            };
            var folder = new FolderTestModel();
            var memory = new TypeDictionary();

            memory.GetItem <Settings>().OutputFolder = "output";
            var file = new StoryTestFile("myfile", new StoryTestFolder(memory, folder), folder);

            file.WriteTest(new PageResult("title", content, new TestCounts()));
            Clock.Instance = new Clock();
            Assert.AreEqual(comment + expected, folder.GetPageContent(new FilePath("output\\myfile.html")));
        }
Beispiel #13
0
 public ConfigurationTest()
 {
     myConfiguration = new TypeDictionary();
     myConfiguration.GetItem <TestList>();
     SetSystemUnderTest(myConfiguration);
 }
Beispiel #14
0
 public static Configuration InitAssembliesAndNamespaces()
 {
     var configuration = new TypeDictionary();
     configuration.GetItem<ApplicationUnderTest>().AddAssembly(Assembly.GetAssembly(typeof (TestUtils)).CodeBase);
     configuration.GetItem<ApplicationUnderTest>().AddNamespace("fit.Test.NUnit");
     configuration.GetItem<ApplicationUnderTest>().AddNamespace("fit.Test.Acceptance");
     return configuration;
 }