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(); }
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>(); }
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>(); }
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(); }