示例#1
0
        public void PopulateThrowsExceptionWithNullStrategyBuildChain()
        {
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            executeStrategy.BuildChain.Returns((IBuildChain)null !);

            var sut = new TypeCreatorWrapper();

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

            action.Should().Throw <InvalidOperationException>();
        }
示例#2
0
        public void PopulateThrowsExceptionWithNullType()
        {
            var buildChain      = new BuildHistory();
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            executeStrategy.BuildChain.Returns(buildChain);

            var sut = new TypeCreatorWrapper();

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

            action.Should().Throw <ArgumentNullException>();
        }
示例#3
0
        public void PopulateThrowsExceptionWhenPopulateVerificationFails()
        {
            var buildChain      = new BuildHistory();
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            executeStrategy.BuildChain.Returns(buildChain);

            var sut = new TypeCreatorWrapper();

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

            action.Should().Throw <NotSupportedException>();
        }
示例#4
0
        public void PopulateReturnsProvidedInstance()
        {
            var buildChain      = new BuildHistory();
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            executeStrategy.BuildChain.Returns(buildChain);

            var expected = new List <string>();

            var sut = new TypeCreatorWrapper();

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

            actual.Should().BeSameAs(expected);
        }
示例#5
0
        public void PopulateDoesNotThrowsExceptionWhenPopulateVerificationPasses()
        {
            var buildChain      = new BuildHistory();
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            executeStrategy.BuildChain.Returns(buildChain);

            var value = new List <string>();

            var sut = new TypeCreatorWrapper();

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

            action.Should().NotThrow();
        }
        public void PopulateThrowsExceptionWithNullInstanceTest()
        {
            var executeStrategy = new DummyExecuteStrategy();

            var target = new TypeCreatorWrapper();

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

            action.ShouldThrow<ArgumentNullException>();
        }
        public void PopulateThrowsExceptionWithNullExecuteStrategyTest()
        {
            var person = new Person();

            var target = new TypeCreatorWrapper();

            Action action = () => target.Populate(person, null);

            action.ShouldThrow<ArgumentNullException>();
        }
        public void PopulateThrowsExceptionWhenPopulateVerificationFailsTest()
        {
            var executeStrategy = new DummyExecuteStrategy();

            var target = new TypeCreatorWrapper();

            Action action = () => target.Populate(false, executeStrategy);

            action.ShouldThrow<NotSupportedException>();
        }
        public void PopulateDoesNotThrowsExceptionWhenPopulateVerificationPassesTest()
        {
            var executeStrategy = new DummyExecuteStrategy();
            var value = new List<string>();

            var target = new TypeCreatorWrapper();

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

            action.ShouldNotThrow();
        }