public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess() { var cmd = new EnrollAuthenticatorDeviceCommand("name", new AuthenticatorAttestationRawResponse(), new CredentialCreateOptions()); var validator = new EnrollAuthenticatorDeviceCommandValidator(); var result = validator.Validate(cmd); Assert.True(result.IsValid); }
public void Validate_GivenCredentialCreateOptionsIsNull_ExpectValidationFailure() { var cmd = new EnrollAuthenticatorDeviceCommand("name", new AuthenticatorAttestationRawResponse(), null); var validator = new EnrollAuthenticatorDeviceCommandValidator(); var result = validator.Validate(cmd); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.ErrorCode.Equals(ValidationCodes.FieldIsRequired) && failure.PropertyName == "CredentialCreateOptions"); }