public void CreateTypeThrowsExceptionWithNullType() { var executeStrategy = Substitute.For <IExecuteStrategy>(); var valueGenerator = Substitute.For <IValueGenerator>(); var sut = new BuildCapability(valueGenerator); Action action = () => sut.CreateType(executeStrategy, null !, null); action.Should().Throw <ArgumentNullException>(); }
public void CreateTypeReturnsValueFromValueGenerator() { var type = typeof(string); var value = Guid.NewGuid().ToString(); var executeStrategy = Substitute.For <IExecuteStrategy>(); var valueGenerator = Substitute.For <IValueGenerator>(); valueGenerator.Generate(executeStrategy, type).Returns(value); var sut = new BuildCapability(valueGenerator); var actual = sut.CreateType(executeStrategy, type, null); actual.Should().Be(value); }
public void CreateTypeReturnsValueFromCreationRule() { var type = typeof(string); var value = Guid.NewGuid().ToString(); var executeStrategy = Substitute.For <IExecuteStrategy>(); var creationRule = Substitute.For <ICreationRule>(); creationRule.Create(executeStrategy, type).Returns(value); var sut = new BuildCapability(creationRule); var actual = sut.CreateType(executeStrategy, type, null); actual.Should().Be(value); }
public void CreateTypeReturnsValueFromTypeCreator() { var type = typeof(string); var value = Guid.NewGuid().ToString(); var args = new object?[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }; var executeStrategy = Substitute.For <IExecuteStrategy>(); var typeCreator = Substitute.For <ITypeCreator>(); typeCreator.Create(executeStrategy, type, args).Returns(value); var sut = new BuildCapability(typeCreator, true, false); var actual = sut.CreateType(executeStrategy, type, args); actual.Should().Be(value); }