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 PopulateThrowsExceptionWithNullExecuteStrategy() { var person = new Person(); var sut = new TypeCreatorWrapper(); Action action = () => sut.Populate(null !, person); action.Should().Throw <ArgumentNullException>(); }
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 CanCreateThrowsExceptionWithNullType() { var configuration = Substitute.For <IBuildConfiguration>(); var sut = new TypeCreatorWrapper(); Action action = () => sut.CanCreate(configuration, null !, (Type)null !); action.Should().Throw <ArgumentNullException>(); }
public void CanPopulateThrowsExceptionWithNullProperty() { var configuration = Substitute.For <IBuildConfiguration>(); var buildChain = new BuildHistory(); var sut = new TypeCreatorWrapper(); Action action = () => sut.CanPopulate(configuration, buildChain, (PropertyInfo)null !); action.Should().Throw <ArgumentNullException>(); }
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>(); }
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>(); }
public void CreateForTypeThrowsExceptionWithNullStrategy() { var buildChain = new BuildHistory(); var executeStrategy = Substitute.For <IExecuteStrategy>(); executeStrategy.BuildChain.Returns(buildChain); var sut = new TypeCreatorWrapper(); Action action = () => sut.Create(null !, typeof(string)); action.Should().Throw <ArgumentNullException>(); }
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>(); }
public void CreateForPropertyThrowsExceptionWithNullStrategy() { var property = typeof(Person).GetProperty(nameof(Person.FirstName)) !; var buildChain = new BuildHistory(); var executeStrategy = Substitute.For <IExecuteStrategy>(); executeStrategy.BuildChain.Returns(buildChain); var sut = new TypeCreatorWrapper(); Action action = () => sut.Create(null !, property); action.Should().Throw <ArgumentNullException>(); }
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 CreateForParameterThrowsExceptionWithNullStrategy() { var parameterInfo = typeof(Person).GetConstructors() .First(x => x.GetParameters().FirstOrDefault()?.Name == "firstName").GetParameters().First(); var buildChain = new BuildHistory(); var executeStrategy = Substitute.For <IExecuteStrategy>(); executeStrategy.BuildChain.Returns(buildChain); var sut = new TypeCreatorWrapper(); Action action = () => sut.Create(null !, parameterInfo); action.Should().Throw <ArgumentNullException>(); }
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); }
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(); }
public void PopulateDoesNotThrowsExceptionWhenPopulateVerificationPassesTest() { var executeStrategy = new DummyExecuteStrategy(); var value = new List<string>(); var target = new TypeCreatorWrapper(); Action action = () => target.Populate(value, executeStrategy); action.ShouldNotThrow(); }
public void PopulateThrowsExceptionWithNullExecuteStrategyTest() { var person = new Person(); var target = new TypeCreatorWrapper(); Action action = () => target.Populate(person, null); action.ShouldThrow<ArgumentNullException>(); }
public void PopulateThrowsExceptionWithNullInstanceTest() { var executeStrategy = new DummyExecuteStrategy(); var target = new TypeCreatorWrapper(); Action action = () => target.Populate(null, executeStrategy); action.ShouldThrow<ArgumentNullException>(); }
public void GeneratorReturnsInstanceTest() { var target = new TypeCreatorWrapper(); target.Random.Should().NotBeNull(); }
public void PopulateThrowsExceptionWhenPopulateVerificationFailsTest() { var executeStrategy = new DummyExecuteStrategy(); var target = new TypeCreatorWrapper(); Action action = () => target.Populate(false, executeStrategy); action.ShouldThrow<NotSupportedException>(); }
public void GeneratorReturnsInstance() { var sut = new TypeCreatorWrapper(); sut.Random.Should().NotBeNull(); }