Beispiel #1
0
        public void CreatingValueDoesNotWriteLogWhenDisabled()
        {
            var generatorType = typeof(StateValueGenerator);
            var type          = typeof(string);

            var sut = new DefaultBuildLog();

            sut.CreatingValue(type, generatorType, null !);

            sut.Output.Should().BeEmpty();
        }
Beispiel #2
0
        public void CreatingValueThrowsExceptionWithNullGeneratorType()
        {
            var type = typeof(string);

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            Action action = () => sut.CreatingValue(type, null !, null !);

            action.Should().Throw <ArgumentNullException>();
        }
        public void ClearRemovesExistingBuildLogDataTest()
        {
            var target = new DefaultBuildLog();

            target.CreatingValue(typeof(string), null);

            target.Output.Should().NotBeNullOrWhiteSpace();

            target.Clear();

            target.Output.Should().BeNullOrWhiteSpace();
        }
Beispiel #4
0
        public void CreatingValueAppendsLogEntry()
        {
            var generatorType = typeof(StateValueGenerator);
            var type          = typeof(string);

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            sut.CreatingValue(type, generatorType, null !);

            sut.Output.Should().NotBeNullOrWhiteSpace();
        }
Beispiel #5
0
        public void ClearRemovesExistingBuildLogData()
        {
            var generatorType = typeof(StateValueGenerator);
            var type          = typeof(string);

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            sut.CreatingValue(type, generatorType, null !);

            sut.Output.Should().NotBeNullOrWhiteSpace();

            sut.Clear();

            sut.Output.Should().BeNullOrWhiteSpace();
        }
Beispiel #6
0
        public void CreateTypeIndentsChildMessages()
        {
            var generatorType = typeof(StateValueGenerator);
            var creatorType   = typeof(DefaultTypeCreator);

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            sut.CreatingType(typeof(Person), creatorType, null !);
            sut.CreatingValue(typeof(string), generatorType, null !);
            sut.CreatedType(typeof(Person), null !);

            var actual = sut.Output;

            actual.Should().Contain("    ");
        }
Beispiel #7
0
        public void PopulateInstanceIndentsChildMessages()
        {
            var generatorType = typeof(StateValueGenerator);
            var type          = typeof(string);

            var instance = new Person();

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            sut.PopulatingInstance(instance);
            sut.CreatingValue(type, generatorType, null !);
            sut.PopulatedInstance(instance);

            var actual = sut.Output;

            actual.Should().Contain("    ");
        }
        public void PopulateInstanceIndentsChildMessagesTest()
        {
            var instance = new Person();

            var target = new DefaultBuildLog();

            target.PopulatingInstance(instance);
            target.CreatingValue(typeof(string), null);
            target.PopulatedInstance(instance);

            var actual = target.Output;

            actual.Should().Contain("    ");
        }
        public void CreatingValueThrowsExceptionWithNullValueTest()
        {
            var target = new DefaultBuildLog();

            Action action = () => target.CreatingValue(null, null);

            action.ShouldThrow<ArgumentNullException>();
        }
        public void CreatingValueAppendsLogEntryTest()
        {
            var target = new DefaultBuildLog();

            target.CreatingValue(typeof(string), null);

            target.Output.Should().NotBeNullOrWhiteSpace();
        }
        public void CreateTypeIndentsChildMessagesTest()
        {
            var target = new DefaultBuildLog();

            target.CreatingType(typeof(Person), null);
            target.CreatingValue(typeof(string), null);
            target.CreatedType(typeof(Person), null);

            var actual = target.Output;

            actual.Should().Contain("    ");
        }