public void PopulateThrowsExceptionWithNullProperty()
        {
            var executeStrategy = Substitute.For <IExecuteStrategy>();
            var typeCreator     = Substitute.For <ITypeCreator>();

            var sut = new BuildCapability(typeCreator, true, true);

            Action action = () => sut.Populate(executeStrategy, null !);

            action.Should().Throw <ArgumentNullException>();
        }
        public void PopulateWithValueGeneratorThrowsException()
        {
            var value = new Person();

            var executeStrategy = Substitute.For <IExecuteStrategy>();
            var valueGenerator  = Substitute.For <IValueGenerator>();

            var sut = new BuildCapability(valueGenerator);

            Action action = () => sut.Populate(executeStrategy, value);

            action.Should().Throw <NotSupportedException>();
        }
        public void PopulateWithCreationRuleThrowsException()
        {
            var value = new Person();

            var executeStrategy = Substitute.For <IExecuteStrategy>();
            var creationRule    = Substitute.For <ICreationRule>();

            var sut = new BuildCapability(creationRule);

            Action action = () => sut.Populate(executeStrategy, value);

            action.Should().Throw <NotSupportedException>();
        }
        public void PopulateWithTypeCreatorReturnsValue()
        {
            var expected = new Person();

            var executeStrategy = Substitute.For <IExecuteStrategy>();
            var typeCreator     = Substitute.For <ITypeCreator>();

            typeCreator.Populate(executeStrategy, expected).Returns(expected);

            var sut = new BuildCapability(typeCreator, false, true);

            var actual = sut.Populate(executeStrategy, expected);

            actual.Should().Be(expected);
        }