public void CreateThrowsExceptionWhenCreateVerificationFailsTest()
        {
            var buildChain = new LinkedList<object>();

            var target = new TypeCreatorWrapper();

            Action action = () => target.Create(typeof(bool), null, buildChain);

            action.ShouldThrow<NotSupportedException>();
        }
        public void CreateDoesNotThrowsExceptionWhenCreateVerificationPassesTest()
        {
            var buildChain = new LinkedList<object>();

            var target = new TypeCreatorWrapper();

            Action action = () => target.Create(typeof(List<string>), null, buildChain);

            action.ShouldNotThrow();
        }
示例#3
0
        public void CreateThrowsExceptionWithNullStrategyBuildChain()
        {
            var executeStrategy = Substitute.For <IExecuteStrategy>();

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

            var sut = new TypeCreatorWrapper();

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

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

            executeStrategy.BuildChain.Returns(buildChain);

            var sut = new TypeCreatorWrapper();

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

            action.Should().Throw <ArgumentNullException>();
        }
示例#5
0
        public void CreateReturnsValue()
        {
            var targetType = typeof(List <string>);

            var typeResolver    = Substitute.For <ITypeResolver>();
            var configuration   = Substitute.For <IBuildConfiguration>();
            var executeStrategy = Substitute.For <IExecuteStrategy>();

            configuration.TypeResolver.Returns(typeResolver);
            typeResolver.GetBuildType(configuration, targetType).Returns(targetType);
            executeStrategy.Configuration.Returns(configuration);

            var sut = new TypeCreatorWrapper();

            var actual = sut.Create(executeStrategy, targetType);

            actual.Should().NotBeNull();
        }