public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess() { var request = new EnrollAuthAppRequest { Code = "code", SharedKey = "shared-key", }; var validator = new EnrollAuthAppRequest.Validator(); var result = validator.Validate(request); Assert.True(result.IsValid); }
public void Validate_GivenSharedKeyIsNull_ExpectValidationFailure() { var request = new EnrollAuthAppRequest { Code = "code", SharedKey = null, }; var validator = new EnrollAuthAppRequest.Validator(); var result = validator.Validate(request); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.PropertyName == "SharedKey"); }
public void Validate_GivenCodeIsEmpty_ExpectValidationFailure() { var request = new EnrollAuthAppRequest { Code = string.Empty, SharedKey = "shared-key", }; var validator = new EnrollAuthAppRequest.Validator(); var result = validator.Validate(request); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.PropertyName == "Code"); }