Inheritance: IRunSettingsService
Example #1
0
        public void AddRunSettings_UserSettingsWithoutRunSettingsNode_Warning()
        {
            Mock <ILogger> mockLogger = new Mock <ILogger>();
            Mock <IRunSettingsConfigurationInfo> mockRunSettingsConfigInfo = new Mock <IRunSettingsConfigurationInfo>();

            RunSettingsService service = SetupRunSettingsService(mockLogger, XmlFileBroken);

            XmlDocument xml = new XmlDocument();

            xml.Load(UserTestSettingsWithoutRunSettingsNode);

            service.AddRunSettings(xml, mockRunSettingsConfigInfo.Object, mockLogger.Object);

            mockLogger.Verify(l => l.Log(It.Is <MessageLevel>(ml => ml == MessageLevel.Warning), It.Is <string>(s => s.Contains("does not contain a RunSettings node"))),
                              Times.Exactly(1));
        }
Example #2
0
        public void AddRunSettings_GlobalAndSolutionAndUserSettings_CorrectOverridingHierarchy()
        {
            Mock <ILogger> mockLogger = new Mock <ILogger>();
            Mock <IRunSettingsConfigurationInfo> mockRunSettingsConfigInfo = new Mock <IRunSettingsConfigurationInfo>();

            RunSettingsService service = SetupRunSettingsService(mockLogger, SolutionTestSettings);

            XmlDocument xml = new XmlDocument();

            xml.Load(UserTestSettings);

            service.AddRunSettings(xml, mockRunSettingsConfigInfo.Object, mockLogger.Object);

            // 1: from global, 2: from solution, 3, ShuffleTests: from user test settings
            AssertContainsSetting(xml, "AdditionalTestExecutionParam", "Global");
            AssertContainsSetting(xml, "BatchForTestSetup", "Solution");
            AssertContainsSetting(xml, "ShuffleTests", "true");
            AssertContainsSetting(xml, "NrOfTestRepetitions", "2");
            AssertContainsSetting(xml, "MaxNrOfThreads", "3");
            AssertContainsSetting(xml, "ShuffleTestsSeed", "3");
            AssertContainsSetting(xml, "TraitsRegexesBefore", "User");
        }
Example #3
0
        public void AddRunSettings_BrokenSolutionSettings_Warning()
        {
            Mock <ILogger> mockLogger = new Mock <ILogger>();
            Mock <IRunSettingsConfigurationInfo> mockRunSettingsConfigInfo = new Mock <IRunSettingsConfigurationInfo>();

            RunSettingsService service = SetupRunSettingsService(mockLogger, XmlFileBroken);

            XmlDocument xml = new XmlDocument();

            xml.Load(UserTestSettings);

            service.AddRunSettings(xml, mockRunSettingsConfigInfo.Object, mockLogger.Object);

            // 1: from global, 2: from solution, 3, ShuffleTests: from user test settings
            AssertContainsSetting(xml, "AdditionalTestExecutionParam", "Global");
            AssertContainsSetting(xml, "ShuffleTests", "true");
            AssertContainsSetting(xml, "NrOfTestRepetitions", "1");
            AssertContainsSetting(xml, "MaxNrOfThreads", "3");
            AssertContainsSetting(xml, "ShuffleTestsSeed", "3");
            AssertContainsSetting(xml, "TraitsRegexesBefore", "User");

            mockLogger.Verify(l => l.Log(It.Is <MessageLevel>(ml => ml == MessageLevel.Warning), It.Is <string>(s => s.Contains("could not be parsed"))),
                              Times.Exactly(1));
        }