// todo: Refactor into multiple unit tests public void CashoutOnlyRequest_OnValidRequestWithTransactionsOptions_ReturnObjects() { // arrange const string posRefId = "123"; const int amountCents = 1000; const string receiptHeader = "Receipt Header"; const string receiptFooter = "Receipt Footer"; var config = new SpiConfig { PrintMerchantCopy = true, PromptForCustomerCopyOnEftpos = false, SignatureFlowOnEftpos = true }; var options = new TransactionOptions(); options.SetCustomerReceiptHeader(receiptHeader); // todo: any method in arrange should be unit tested options.SetCustomerReceiptFooter(receiptFooter); options.SetMerchantReceiptHeader(receiptHeader); options.SetMerchantReceiptFooter(receiptFooter); // act var request = new CashoutOnlyRequest(amountCents, posRefId) { SurchargeAmount = 100, Config = config, Options = options }; var msg = request.ToMessage(); // assert Assert.Equal(posRefId, request.PosRefId); Assert.Equal(amountCents, request.CashoutAmount); Assert.Equal(config.PrintMerchantCopy, msg.GetDataBoolValue("print_merchant_copy", false)); Assert.Equal(config.PromptForCustomerCopyOnEftpos, msg.GetDataBoolValue("prompt_for_customer_copy", false)); Assert.Equal(config.SignatureFlowOnEftpos, msg.GetDataBoolValue("print_for_signature_required_transactions", false)); Assert.Equal(receiptHeader, msg.GetDataStringValue("customer_receipt_header")); Assert.Equal(receiptFooter, msg.GetDataStringValue("customer_receipt_footer")); Assert.Equal(receiptHeader, msg.GetDataStringValue("merchant_receipt_header")); Assert.Equal(receiptFooter, msg.GetDataStringValue("merchant_receipt_footer")); }