public void Validate_GivenValidModel_ReturnsTrue() { //Arrange CreateDefinitionSpecificationRelationshipModel model = CreateModel(); CreateDefinitionSpecificationRelationshipModelValidator validator = CreateValidator(); //Act ValidationResult result = validator.Validate(model); //Assert result .IsValid .Should() .BeTrue(); }
public void Validate_GivenMissingDescription_ReturnsFalse() { //Arrange CreateDefinitionSpecificationRelationshipModel model = CreateModel(); model.Description = string.Empty; CreateDefinitionSpecificationRelationshipModelValidator validator = CreateValidator(); //Act ValidationResult result = validator.Validate(model); //Assert result .IsValid .Should() .BeFalse(); result .Errors .Count .Should() .Be(1); }
public void Validate_GivenNameAlreadyExistsn_ReturnsFalse() { //Arrange CreateDefinitionSpecificationRelationshipModel model = CreateModel(); IDatasetRepository repository = CreateDatasetRepository(false); CreateDefinitionSpecificationRelationshipModelValidator validator = CreateValidator(repository); //Act ValidationResult result = validator.Validate(model); //Assert result .IsValid .Should() .BeFalse(); result .Errors .Count .Should() .Be(1); }