public void Validate_PostDataIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("postData", () => { PaymentPostDataValidator.Validate(new KassaConfiguration(), null); }); }
public void Validate_ConfigurationIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("configuration", () => { PaymentPostDataValidator.Validate(null, new PaymentPostData()); }); }
public void Validate_IsValid_NoException() { PaymentPostData postData = new PaymentPostData() { Data = "data", Seal = _expectedSeal, }; PaymentPostDataValidator.Validate(_configuration, postData); }
internal IPaymentResponse GetResponse(IPaymentPostData response) { PaymentPostDataValidator.Validate(Configuration, response); IPaymentResponse result = PaymentResponse.Create(response.Data); PaymentResponseValidator.Validate(Configuration, result); return(result); }
public void Validate_DataIsWhitespace_ThrowsException() { PaymentPostData postData = new PaymentPostData() { Data = " ", Seal = _expectedSeal, }; ExceptionAssert.ThrowsWhitespaceValidationException(nameof(postData.Data), () => { PaymentPostDataValidator.Validate(_configuration, postData); }); }
public void Validate_DataIsEmpty_ThrowsException() { PaymentPostData postData = new PaymentPostData() { Data = string.Empty, Seal = _expectedSeal, }; ExceptionAssert.ThrowsEmptyValidationException(nameof(postData.Data), () => { PaymentPostDataValidator.Validate(_configuration, postData); }); }
public void Validate_SealIsWhitespace_ThrowsException() { PaymentPostData postData = new PaymentPostData() { Data = "data", Seal = " ", }; ExceptionAssert.Throws <InvalidOperationException>($"The seal is invalid.{Environment.NewLine}Expected value: {_expectedSeal}.", () => { PaymentPostDataValidator.Validate(_configuration, postData); }); }
public void Validate_InterfaceVersionIsInvalid_ThrowsNoException() { /* * It appears that the api can send a V2 response when our request * was V1 so this should not throw an exception. */ PaymentPostData postData = new PaymentPostData() { Data = "data", InterfaceVersion = "HP_1.1", Seal = _expectedSeal, }; PaymentPostDataValidator.Validate(_configuration, postData); }