コード例 #1
0
        public ValidatingConfigReaderTests()
        {
            reader = new FakeConfigReader();
            reader.SetDefaultFakeConfig();
            logger    = new FakeLogger();
            validator = new FakeHosterValidator();

            sut = new ValidatingConfigReader(reader, logger, validator);
        }
コード例 #2
0
        public void LogsErrorWhenConfigSourceTitlesContainDuplicates()
        {
            reader = new FakeConfigReader();
            reader.SetDefaultFakeConfig();
            var source = new ConfigSource();

            source.Title = "title";
            source.Type  = "fake";

            reader.FakeConfig.Sources.Add(source);

            logger    = new FakeLogger();
            validator = new FakeHosterValidator();

            sut = new ValidatingConfigReader(reader, logger, validator);
            var result = sut.ReadConfig();

            Assert.True(logger.LoggedSomething);
            Assert.Equal(ErrorLevel.Error, logger.LastErrorLevel);
            Assert.Null(result);
        }