Adding
This commit is contained in:
+310
@@ -0,0 +1,310 @@
|
||||
using Moq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Web.Http.Results;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class AccountControllerTest
|
||||
{
|
||||
private AccountController _controller;
|
||||
private Mock<IAccountService> _mockAccountService;
|
||||
|
||||
public AccountControllerTest()
|
||||
{
|
||||
_mockAccountService = new Mock<IAccountService>();
|
||||
_controller = new AccountController(_mockAccountService.Object);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void GetAccountByAccountNumber_OK()
|
||||
{
|
||||
|
||||
var maintenanceResponse = new AccountDetailInquiryResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.GetAccountByAccountNumber(100L)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _controller.GetAccountByAccountNumber(100L);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<AccountDetailInquiryResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetAccountByAccountNumber_LongIsZero_BadRequest()
|
||||
{
|
||||
|
||||
_mockAccountService.Verify(x => x.GetAccountByAccountNumber(It.IsAny<long>()),
|
||||
Times.Never);
|
||||
|
||||
var result = _controller.GetAccountByAccountNumber(0);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify(x => x.GetAccountByAccountNumber(It.IsAny<long>()), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetAccountByAccountNumber_Exception()
|
||||
{
|
||||
_mockAccountService.Setup(x => x.GetAccountByAccountNumber(100L)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.GetAccountByAccountNumber(100);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountMaintenanceRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<AccountMaintenanceResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountMaintenanceRequest_Null_BadRequest()
|
||||
{
|
||||
|
||||
_mockAccountService.Verify(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>()),
|
||||
Times.Never);
|
||||
|
||||
var result = _controller.PutAccountMaintenanceRequest(null);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>()),
|
||||
Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountMaintenanceRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountAnalysisGroupMaintenanceRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountAnalysisGroupMaintenanceRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountAnalysisGroupMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountAnalysisGroupMaintenanceRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountAnalysisGroupMaintenanceRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountAnalysisGroupMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
[TestMethod]
|
||||
public void PutAccountNickNameUpdateRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountNickNameUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
AccountDescription = "TestSuccess"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountNickNameUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountNickNameUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountNickNameUpdateRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountNickNameUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
AccountDescription = "TestException"
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountNickNameUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountNickNameUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
[TestMethod]
|
||||
public void PutAccountCreditReportTypeUpdateRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountCreditReportTypeUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
CreditReportType = "EXCL"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountCreditReportTypeUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountCreditReportTypeUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountCreditReportTypeUpdateRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountCreditReportTypeUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
CreditReportType = "EXCL"
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountCreditReportTypeUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountCreditReportTypeUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountContractDateUpdateRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountContractDateUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
ContractDate = DateTime.Now,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountContractDateUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountContractDateUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountContractDateUpdateRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountContractDateUpdateRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
ContractDate = DateTime.Now,
|
||||
};
|
||||
|
||||
_mockAccountService.Setup(x => x.SendAccountContractDateUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutAccountContractDateUpdateRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockAccountService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Web.Http.Results;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class CollateralMaintenanceControllerTest
|
||||
{
|
||||
private CollateralMaintenanceController _controller;
|
||||
private Mock<ICollateralMaintenanceService> _mockCollateralMaintenanceService;
|
||||
|
||||
public CollateralMaintenanceControllerTest()
|
||||
{
|
||||
_mockCollateralMaintenanceService = new Mock<ICollateralMaintenanceService>();
|
||||
_controller = new CollateralMaintenanceController(_mockCollateralMaintenanceService.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPropertyByPropertyNumber_OK()
|
||||
{
|
||||
var searchResponse = new CollateralSearchResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralMaintenanceService.Setup(x => x.GetCollateralMaintenanceByPropertyNumber(15000)).Returns(searchResponse).Verifiable();
|
||||
|
||||
var result = _controller.Get(15000);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<CollateralSearchResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPropertyByPropertyNumber_IntIsZero_BadRequest()
|
||||
{
|
||||
|
||||
_mockCollateralMaintenanceService.Verify(x => x.GetCollateralMaintenanceByPropertyNumber(It.IsAny<int>()),
|
||||
Times.Never);
|
||||
|
||||
var result = _controller.Get(0);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockCollateralMaintenanceService.Verify(x => x.GetCollateralMaintenanceByPropertyNumber(It.IsAny<int>()), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPropertyByPropertyNumber_Exception()
|
||||
{
|
||||
_mockCollateralMaintenanceService.Setup(x => x.GetCollateralMaintenanceByPropertyNumber(15000)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.Get(15000);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
var fieldRequest = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 11111,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralMaintenanceService.Setup(x => x.UpdateCollateralMaintenance(fieldRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PutCollateralMaintenance(fieldRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutAccountMaintenanceRequest_Exception()
|
||||
{
|
||||
var fieldRequest = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 11111,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
_mockCollateralMaintenanceService.Setup(x => x.UpdateCollateralMaintenance(fieldRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutCollateralMaintenance(fieldRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
var fieldRequest = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 11111,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralMaintenanceService.Setup(x => x.InsertCollateralMaintenance(fieldRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
|
||||
|
||||
var result = _controller.PostCollateralMaintenance(fieldRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.Success);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostCollateralMaintenanceRequest_Exception()
|
||||
{
|
||||
var fieldRequest = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 11111,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
_mockCollateralMaintenanceService.Setup(x => x.InsertCollateralMaintenance(fieldRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PostCollateralMaintenance(fieldRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockCollateralMaintenanceService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System.Web.Http.Results;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Response;
|
||||
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class indirectLoanControllerTest
|
||||
{
|
||||
private IndirectLoanController _controller;
|
||||
private Mock<IIndirectLoanService> _mockIndirectLoanService;
|
||||
|
||||
public indirectLoanControllerTest()
|
||||
{
|
||||
_mockIndirectLoanService = new Mock<IIndirectLoanService>();
|
||||
_controller = new IndirectLoanController(_mockIndirectLoanService.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutDealerOriginalBalanceRequest_OK()
|
||||
{
|
||||
var request = "19618754052";
|
||||
var response = new UpdateDealerOriginalBalanceResponse();
|
||||
|
||||
var responseList = new List<UpdateDealerOriginalBalanceResponse> { response };
|
||||
_mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalances(request)).Returns(responseList).Verifiable();
|
||||
|
||||
var result = _controller.PutDealerOriginalBalance(request);
|
||||
Assert.IsNotNull(result);
|
||||
|
||||
var okResult = result as OkNegotiatedContentResult<List<UpdateDealerOriginalBalanceResponse>>;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockIndirectLoanService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutDealerOriginalBalance_Exception()
|
||||
{
|
||||
|
||||
var request = "19618754052";
|
||||
var response = new UpdateDealerOriginalBalanceResponse()
|
||||
{
|
||||
AccountNumber = "19618754052",
|
||||
ErrorMessage = "Error: 000000 This account has failed to update."
|
||||
};
|
||||
|
||||
var responseList = new List<UpdateDealerOriginalBalanceResponse> { response };
|
||||
_mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalances(request)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutDealerOriginalBalance(request);
|
||||
Assert.IsNotNull(result);
|
||||
var badResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(badResult);
|
||||
_mockIndirectLoanService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Web.Http.Results;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class MonetaryTransactionControllerTest
|
||||
{
|
||||
private MonetaryTransactionController _controller;
|
||||
private Mock<IMonetaryTransactionService> _mockMonetaryTransactionService;
|
||||
|
||||
public MonetaryTransactionControllerTest()
|
||||
{
|
||||
_mockMonetaryTransactionService = new Mock<IMonetaryTransactionService>();
|
||||
_controller = new MonetaryTransactionController(_mockMonetaryTransactionService.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostMonetaryTransactionsRequest_OK()
|
||||
{
|
||||
|
||||
var groupRequest = new GroupedMonetaryTransactionRequest()
|
||||
{
|
||||
|
||||
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var response = new MonetaryTransactionResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var listResponse = new List<MonetaryTransactionResponse> { response };
|
||||
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
|
||||
|
||||
_mockMonetaryTransactionService.Setup(x => x.AddMonetaryTransactions(listGroupRequest)).Returns(listResponse).Verifiable();
|
||||
|
||||
var result = _controller.PostMonetaryTransactions(listGroupRequest);
|
||||
Assert.IsNotNull(result);
|
||||
|
||||
var okResult = result as OkNegotiatedContentResult<List<MonetaryTransactionResponse>>;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockMonetaryTransactionService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostMonetaryTransactionsRequest_Exception()
|
||||
{
|
||||
|
||||
var groupRequest = new GroupedMonetaryTransactionRequest()
|
||||
{
|
||||
|
||||
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var response = new MonetaryTransactionResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var listResponse = new List<MonetaryTransactionResponse> { response };
|
||||
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
|
||||
|
||||
_mockMonetaryTransactionService.Setup(x => x.AddMonetaryTransactions(listGroupRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PostMonetaryTransactions(listGroupRequest);
|
||||
Assert.IsNotNull(result);
|
||||
var badResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(badResult);
|
||||
_mockMonetaryTransactionService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Moq;
|
||||
using System.Web.Http.Results;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class PersonAgreementControllerTest
|
||||
{
|
||||
private PersonAgreementController _controller;
|
||||
private Mock<IPersonAgreementService> _mockPersonAgreementService;
|
||||
|
||||
public PersonAgreementControllerTest()
|
||||
{
|
||||
_mockPersonAgreementService = new Mock<IPersonAgreementService>();
|
||||
_controller = new PersonAgreementController(_mockPersonAgreementService.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutPersonAgreementsDetailTypes_Null_BadRequest()
|
||||
{
|
||||
|
||||
_mockPersonAgreementService.Verify(x => x.UpdatePersonAgreementsDetailTypes(
|
||||
It.IsAny<PersonAgreementDetailTypeRequest>()), Times.Never);
|
||||
|
||||
var result = _controller.PutPersonAgreementsDetailTypes(null);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockPersonAgreementService.Verify(x => x.UpdatePersonAgreementsDetailTypes(
|
||||
It.IsAny<PersonAgreementDetailTypeRequest>()), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutPersonAgreementsDetailTypes_Exception()
|
||||
{
|
||||
var request = new PersonAgreementDetailTypeRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
AgreeNumber = 2,
|
||||
DetailTypes = new List<DetailType>()
|
||||
{
|
||||
new DetailType()
|
||||
{
|
||||
DetailTypeCode = "Stat",
|
||||
DetailValue = "CLOS"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockPersonAgreementService.Setup(x => x.UpdatePersonAgreementsDetailTypes(request))
|
||||
.Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.PutPersonAgreementsDetailTypes(request);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockPersonAgreementService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using System.Web.Http.Results;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class StatusControllerTest
|
||||
{
|
||||
private StatusController _controller;
|
||||
|
||||
public StatusControllerTest()
|
||||
{
|
||||
_controller = new StatusController();
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void Get_OK()
|
||||
{
|
||||
var result = _controller.Get();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
|
||||
var okResult = result as OkNegotiatedContentResult<EnvironmentView>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.AreEqual("LCU.API.Internal.CoreSoapApiWrapper", okResult.Content.Application);
|
||||
}
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Moq;
|
||||
using System.Web.Http.Results;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
|
||||
{
|
||||
[TestClass]
|
||||
public class TaxControllerTest
|
||||
{
|
||||
private TaxController _controller;
|
||||
private Mock<ITaxService> _mockTaxService;
|
||||
|
||||
public TaxControllerTest()
|
||||
{
|
||||
_mockTaxService = new Mock<ITaxService>();
|
||||
_controller = new TaxController(_mockTaxService.Object);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_OK()
|
||||
{
|
||||
|
||||
var maintenanceResponse = new GetTaxIdDataResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockTaxService.Setup(x => x.GetTaxIdData(100L)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _controller.GetTaxIdData(100L);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as OkNegotiatedContentResult<GetTaxIdDataResponse>;
|
||||
Assert.IsNotNull(okResult);
|
||||
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
|
||||
_mockTaxService.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_LongIsZero_BadRequest()
|
||||
{
|
||||
|
||||
_mockTaxService.Verify(x => x.GetTaxIdData(It.IsAny<long>()),
|
||||
Times.Never);
|
||||
|
||||
var result = _controller.GetTaxIdData(0);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockTaxService.Verify(x => x.GetTaxIdData(It.IsAny<long>()), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_Exception()
|
||||
{
|
||||
_mockTaxService.Setup(x => x.GetTaxIdData(100L)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var result = _controller.GetTaxIdData(100);
|
||||
Assert.IsNotNull(result);
|
||||
var okResult = result as BadRequestErrorMessageResult;
|
||||
Assert.IsNotNull(okResult);
|
||||
_mockTaxService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.DataAccess
|
||||
{
|
||||
[TestClass]
|
||||
public class AccountDaoTest
|
||||
{
|
||||
private AccountDao _dao;
|
||||
private Mock<ICoreSoapRequest> _mockCoreSoapRequest;
|
||||
|
||||
public AccountDaoTest()
|
||||
{
|
||||
_mockCoreSoapRequest = new Mock<ICoreSoapRequest>();
|
||||
_dao = new AccountDao(_mockCoreSoapRequest.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FindAccountByAccountNumber_OK()
|
||||
{
|
||||
var response = new AccountDetailInquiryResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountDetailInquiryRequest, AccountDetailInquiryResponse>(It.Is<AccountDetailInquiryRequest>(req => req.AccountNumber == 100L && req.AvailableMethodCode.Equals("ABHP") && req.IsExternalEntity == false && req.IsGetRTXNData == false))).Returns(response).Verifiable();
|
||||
|
||||
var result = _dao.FindAccountByAccountNumber(100L);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FindAccountByAccountNumber_Exception()
|
||||
{
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountDetailInquiryRequest, AccountDetailInquiryResponse>(It.IsAny<AccountDetailInquiryRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.FindAccountByAccountNumber(100L));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountMaintenanceRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _dao.SendAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountMaintenanceRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.SendAccountMaintenanceRequest(maintenanceRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountNickNameUpdateRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
AccountDescription = "TestSuccess"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _dao.SendAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountNickNameUpdateRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
AccountDescription = "TestException"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.SendAccountMaintenanceRequest(maintenanceRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountCreditReportTypeUpdateRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
IsAccountMaintenance = true,
|
||||
AccountLoanDetail = new AccountLoanDetail()
|
||||
{
|
||||
AccountLoanInformation = new AccountLoanInformation()
|
||||
{
|
||||
CreditReportTypeCode = "EXCL"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _dao.SendAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountCreditReportTypeUpdateRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
IsAccountMaintenance = true,
|
||||
AccountLoanDetail = new AccountLoanDetail()
|
||||
{
|
||||
AccountLoanInformation = new AccountLoanInformation()
|
||||
{
|
||||
CreditReportTypeCode = "EXCL"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.SendAccountMaintenanceRequest(maintenanceRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.DataAccess
|
||||
{
|
||||
[TestClass]
|
||||
public class CollateralMaintenanceDaoTest
|
||||
{
|
||||
private CollateralMaintenanceDao _dao;
|
||||
private Mock<ICoreSoapRequest> _mockCoreSoapRequest;
|
||||
|
||||
public CollateralMaintenanceDaoTest()
|
||||
{
|
||||
_mockCoreSoapRequest = new Mock<ICoreSoapRequest>();
|
||||
_dao = new CollateralMaintenanceDao(_mockCoreSoapRequest.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FindPropertyByPropertyNumber_OK()
|
||||
{
|
||||
var response = new CollateralSearchResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralSearchRequest, CollateralSearchResponse>(It.Is<CollateralSearchRequest>(req => req.PropertyCollateral.PropertyNumber == 100000))).Returns(response).Verifiable();
|
||||
|
||||
var result = _dao.FindCollateralMaintenanceByPropertyNumber(100000);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FindPropertyByPropertyNumber_Exception()
|
||||
{
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralSearchRequest, CollateralSearchResponse>(It.IsAny<CollateralSearchRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.FindCollateralMaintenanceByPropertyNumber(100000));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
UserFieldRequest request = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 1,
|
||||
UserFieldCode = "Test",
|
||||
Value = "Test"
|
||||
};
|
||||
|
||||
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(It.IsAny<CollateralMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _dao.AddCollateralMaintenanceByPropertyNumber(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddCollateralMaintenanceRequest_Exception()
|
||||
{
|
||||
UserFieldRequest request = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 1,
|
||||
UserFieldCode = "Test",
|
||||
Value = "Test"
|
||||
};
|
||||
|
||||
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.AddCollateralMaintenanceByPropertyNumber(maintenanceRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
UserFieldRequest request = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 1,
|
||||
UserFieldCode = "Test",
|
||||
Value = "Test"
|
||||
};
|
||||
|
||||
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(It.IsAny<CollateralMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _dao.UpdateCollateralMaintenanceByPropertyNumber(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateCollateralMaintenanceRequest_Exception()
|
||||
{
|
||||
UserFieldRequest request = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 1,
|
||||
UserFieldCode = "Test",
|
||||
Value = "Test"
|
||||
};
|
||||
|
||||
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.UpdateCollateralMaintenanceByPropertyNumber(maintenanceRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
using Moq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Net.Sockets;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models;
|
||||
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.DataAccess
|
||||
{
|
||||
[TestClass]
|
||||
public class IndirectLoanDaoTest
|
||||
{
|
||||
private IndirectLoanDao _dao;
|
||||
private Mock<SoapConfiguration> _mockSoapConfiguration;
|
||||
private Mock<ICoreCmcConnection> _mockCoreCmcConnection;
|
||||
|
||||
public IndirectLoanDaoTest()
|
||||
{
|
||||
_mockSoapConfiguration = new Mock<SoapConfiguration>();
|
||||
_mockCoreCmcConnection = new Mock<ICoreCmcConnection>();
|
||||
_mockSoapConfiguration.Object.IPAddress = "10.10.3.26";
|
||||
_mockSoapConfiguration.Object.PortId = 2500;
|
||||
_mockSoapConfiguration.Object.RequestType = "16340";
|
||||
_mockSoapConfiguration.Object.SocketApplicationId = "7726";
|
||||
_mockSoapConfiguration.Object.SocketDeviceId = "FULL";
|
||||
_mockSoapConfiguration.Object.AuthenticationType = "2";
|
||||
_mockSoapConfiguration.Object.SocketTimeout = 10000;
|
||||
|
||||
_dao = new IndirectLoanDao(_mockSoapConfiguration.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateDealerOriginalBalance_OK()
|
||||
{
|
||||
|
||||
var accountValue = new Cmc.Account()
|
||||
{
|
||||
AcctNbr = "11111111111"
|
||||
};
|
||||
|
||||
var accountRequest = new Cmc.AccountRequest()
|
||||
{
|
||||
Account = accountValue,
|
||||
ReqTypCd = _mockSoapConfiguration.Object.RequestType
|
||||
};
|
||||
|
||||
var userAuthentication = new Cmc.UserAuthentication()
|
||||
{
|
||||
AuthTyp = _mockSoapConfiguration.Object.AuthenticationType,
|
||||
ApplNbr = _mockSoapConfiguration.Object.SocketApplicationId,
|
||||
PhysAddr = _mockSoapConfiguration.Object.SocketDeviceId,
|
||||
UserId = "LOANORIG"
|
||||
//Passwd = "TESTTOKENSTRING" use without token for testing
|
||||
};
|
||||
|
||||
var requestsBase = new List<Cmc.AccountRequest>();
|
||||
requestsBase.Add(accountRequest);
|
||||
|
||||
var input = new Cmc.Input<Cmc.AccountRequest>()
|
||||
{
|
||||
UserAuthentication = userAuthentication,
|
||||
Requests = requestsBase
|
||||
};
|
||||
|
||||
var outputResponse = new Cmc.Response()
|
||||
{
|
||||
SuccessYN = "Y",
|
||||
Errors = new List<Cmc.Error>()
|
||||
};
|
||||
|
||||
var output = new Cmc.Output()
|
||||
{
|
||||
Responses = new List<Cmc.Response>() { outputResponse }
|
||||
};
|
||||
|
||||
var transaction = new Cmc.Transaction<Cmc.AccountRequest>()
|
||||
{
|
||||
Input = input,
|
||||
CommitRollbackYN = "Y",
|
||||
Output = output
|
||||
};
|
||||
_mockCoreCmcConnection.Setup(x => x.CreateSocketTransactionRequest<Cmc.AccountRequest>(It.IsAny<Cmc.AccountRequest>())).Returns(transaction);
|
||||
var result = _dao.UpdateDealerOriginalBalance(transaction);
|
||||
Assert.IsNotNull(result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateDealerOriginalBalance_Exception()
|
||||
{
|
||||
|
||||
var accountValue = new Cmc.Account()
|
||||
{
|
||||
AcctNbr = "11111111111111"
|
||||
};
|
||||
var accountRequest = new Cmc.AccountRequest()
|
||||
{
|
||||
Account = accountValue,
|
||||
ReqTypCd = _mockSoapConfiguration.Object.RequestType
|
||||
};
|
||||
|
||||
|
||||
var userAuthentication = new Cmc.UserAuthentication()
|
||||
{
|
||||
AuthTyp = _mockSoapConfiguration.Object.AuthenticationType,
|
||||
ApplNbr = _mockSoapConfiguration.Object.SocketApplicationId,
|
||||
PhysAddr = _mockSoapConfiguration.Object.SocketDeviceId,
|
||||
Passwd = "TESTTOKENSTRING"
|
||||
};
|
||||
|
||||
var requestsBase = new List<Cmc.AccountRequest>();
|
||||
|
||||
requestsBase.Add(accountRequest);
|
||||
|
||||
var input = new Cmc.Input<Cmc.AccountRequest>()
|
||||
{
|
||||
UserAuthentication = userAuthentication,
|
||||
Requests = requestsBase
|
||||
};
|
||||
|
||||
var transaction = new Cmc.Transaction<Cmc.AccountRequest>()
|
||||
{
|
||||
//this will cause the socket send to timeout and throw an exception
|
||||
};
|
||||
|
||||
Assert.ThrowsException<SocketException>(() => _dao.UpdateDealerOriginalBalance(transaction));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.DataAccess
|
||||
{
|
||||
[TestClass]
|
||||
public class MonetaryTransactionDaoTest
|
||||
{
|
||||
private MonetaryTransactionDao _dao;
|
||||
private Mock<ICoreSoapRequest> _mockCoreSoapRequest;
|
||||
|
||||
public MonetaryTransactionDaoTest()
|
||||
{
|
||||
_mockCoreSoapRequest = new Mock<ICoreSoapRequest>();
|
||||
_dao = new MonetaryTransactionDao(_mockCoreSoapRequest.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddMonetaryTransactions_OK()
|
||||
{
|
||||
var listRequest = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var response = new MonetaryTransactionResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var listResponse = new List<MonetaryTransactionResponse> { response };
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequests<MonetaryTransactionRequest, MonetaryTransactionResponse>(listRequest)).Returns(listResponse).Verifiable();
|
||||
|
||||
var result = _dao.AddMonetaryTransactions(listRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result[0].WasSuccessful);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddMonetaryTransactions_Exception()
|
||||
{
|
||||
var listRequest = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequests<MonetaryTransactionRequest, MonetaryTransactionResponse>(listRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.AddMonetaryTransactions(listRequest));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.DataAccess
|
||||
{
|
||||
[TestClass]
|
||||
public class TaxDaoTest
|
||||
{
|
||||
private readonly TaxDao _dao;
|
||||
private readonly Mock<ICoreSoapRequest> _mockCoreSoapRequest;
|
||||
|
||||
public TaxDaoTest()
|
||||
{
|
||||
_mockCoreSoapRequest = new Mock<ICoreSoapRequest>();
|
||||
_dao = new TaxDao(_mockCoreSoapRequest.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_OK()
|
||||
{
|
||||
var response = new GetTaxIdDataResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<GetTaxIdDataRequest, GetTaxIdDataResponse>(It.Is<GetTaxIdDataRequest>(req => req.ReferenceNumber== "100" && req.MethodNumber == 1))).Returns(response).Verifiable();
|
||||
|
||||
var result = _dao.GetTaxIdData(100L);
|
||||
_mockCoreSoapRequest.Verify();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_Exception()
|
||||
{
|
||||
|
||||
_mockCoreSoapRequest.Setup(x => x.SubmitRequest<GetTaxIdDataRequest, GetTaxIdDataResponse>(It.IsAny<GetTaxIdDataRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _dao.GetTaxIdData(100L));
|
||||
_mockCoreSoapRequest.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LCU.API.Internal.CoreSoapApiWrapperTest</RootNamespace>
|
||||
<AssemblyName>LCU.API.Internal.CoreSoapApiWrapperTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Moq, Version=4.16.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\Moq.4.16.1\lib\net45\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\System.Threading.Tasks.Extensions.4.5.4\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\LCU.API.Internal.CoreSoapApiWrapper\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\CollateralMaintenanceControllerTest.cs" />
|
||||
<Compile Include="Controllers\PersonAgreementControllerTest.cs" />
|
||||
<Compile Include="Controllers\IndirectLoanControllerTest.cs" />
|
||||
<Compile Include="Controllers\MonetaryTransactionControllerTest.cs" />
|
||||
<Compile Include="Controllers\AccountControllerTest.cs" />
|
||||
<Compile Include="Controllers\StatusControllerTest.cs" />
|
||||
<Compile Include="Controllers\TaxControllerTest.cs" />
|
||||
<Compile Include="DataAccess\CollateralMaintenanceDaoTest.cs" />
|
||||
<Compile Include="DataAccess\IndirectLoanDaoTest.cs" />
|
||||
<Compile Include="DataAccess\MonetaryTransactionDaoTest.cs" />
|
||||
<Compile Include="DataAccess\AccountDaoTest.cs" />
|
||||
<Compile Include="DataAccess\TaxDaoTest.cs" />
|
||||
<Compile Include="Services\CollateralMaintenanceServiceTest.cs" />
|
||||
<Compile Include="Services\PersonAgreementServiceTest.cs" />
|
||||
<Compile Include="Services\IndirectLoanServiceTest.cs" />
|
||||
<Compile Include="Services\MonetaryTransactionServiceTest.cs" />
|
||||
<Compile Include="Services\AccountServiceTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\TaxServiceTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LCU.API.Internal.CoreSoapApiWrapper\LCU.API.Internal.CoreSoapApiWrapper.csproj">
|
||||
<Project>{8d3b1fc1-7d69-4cba-932c-4c8b49047394}</Project>
|
||||
<Name>LCU.API.Internal.CoreSoapApiWrapper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\LCU.API.Internal.CoreSoapApiWrapper\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("LCU.API.Internal.CoreSoapApiWrapperTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LCU.API.Internal.CoreSoapApiWrapperTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("c6dfd7d1-6678-4a6c-a74a-b0fdffd71da3")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+461
@@ -0,0 +1,461 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class AccountServicesTest
|
||||
{
|
||||
private AccountService _service;
|
||||
private Mock<IAccountDao> _mockAccountDao;
|
||||
|
||||
public AccountServicesTest()
|
||||
{
|
||||
_mockAccountDao = new Mock<IAccountDao>();
|
||||
_service = new AccountService(_mockAccountDao.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetAccountByAccountNumber_OK()
|
||||
{
|
||||
var accountDetailInquiryResponse = new AccountDetailInquiryResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.FindAccountByAccountNumber(1001)).Returns(accountDetailInquiryResponse).Verifiable();
|
||||
|
||||
var result = _service.GetAccountByAccountNumber(1001);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetAccountByAccountNumber_Exception()
|
||||
{
|
||||
_mockAccountDao.Setup(x => x.FindAccountByAccountNumber(1001)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.GetAccountByAccountNumber(1001));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountMaintenanceRequest_OK()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.SendAccountMaintenanceRequest(maintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountMaintenanceRequest_Exception()
|
||||
{
|
||||
var maintenanceRequest = new AccountMaintenanceRequest
|
||||
{
|
||||
Accounts = new[]{
|
||||
new MaintenanceAccount
|
||||
{
|
||||
AccountNumber = 123456,
|
||||
DeliveryMethodCode = "PRNT"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.SendAccountMaintenanceRequest(maintenanceRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountGroupAnalysisMaintenanceRequest_OK()
|
||||
{
|
||||
var accountList = new List<AccountAnalysisMaintenance>()
|
||||
{
|
||||
new AccountAnalysisMaintenance()
|
||||
{
|
||||
AccountNumber = 11111111
|
||||
}
|
||||
};
|
||||
|
||||
var accountGroupsList = new List<AccountGroupMaintenance>()
|
||||
{
|
||||
new AccountGroupMaintenance()
|
||||
{
|
||||
AccountGroupNumber = 0,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
ServiceChargeAccountNumber = 11111111,
|
||||
StatementAccountNumber = 11111111,
|
||||
Accounts = accountList.ToArray()
|
||||
}
|
||||
};
|
||||
|
||||
var accountAnalysisMaintenanceRequest = new AccountAnalysisMaintenanceRequest()
|
||||
{
|
||||
AccountGroups = accountGroupsList.ToArray()
|
||||
};
|
||||
|
||||
var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountAnalysisMaintenanceRequest(It.IsAny<AccountAnalysisMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
var result = _service.SendAccountAnalysisGroupMaintenanceRequest(accountAnalysisGroupMaintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountGroupAnalysisMaintenanceRequest_Exception()
|
||||
{
|
||||
var accountList = new List<AccountAnalysisMaintenance>()
|
||||
{
|
||||
new AccountAnalysisMaintenance()
|
||||
{
|
||||
AccountNumber = 11111111
|
||||
}
|
||||
};
|
||||
|
||||
var accountGroupsList = new List<AccountGroupMaintenance>()
|
||||
{
|
||||
new AccountGroupMaintenance()
|
||||
{
|
||||
AccountGroupNumber = 0,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
ServiceChargeAccountNumber = 11111111,
|
||||
StatementAccountNumber = 11111111,
|
||||
Accounts = accountList.ToArray()
|
||||
}
|
||||
};
|
||||
|
||||
var accountAnalysisMaintenanceRequest = new AccountAnalysisMaintenanceRequest()
|
||||
{
|
||||
AccountGroups = accountGroupsList.ToArray()
|
||||
};
|
||||
|
||||
var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
|
||||
{
|
||||
AccountNumber = 11111111,
|
||||
IsGenerateAnalysisStatement = true,
|
||||
IsPrintAnalysisStatement = true,
|
||||
IsUseForServiceCharge = true,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountAnalysisMaintenanceRequest(It.IsAny<AccountAnalysisMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.SendAccountAnalysisGroupMaintenanceRequest(accountAnalysisGroupMaintenanceRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPersonAccount_OK()
|
||||
{
|
||||
var createPersonAccountRequest = new CreatePersonAccountRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
FirstName = "Test",
|
||||
LastName = "Tester",
|
||||
BranchOrganizationNumber = 1
|
||||
};
|
||||
var accountMaintenanceResponse = new AccountMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Returns(accountMaintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.AddPersonAccount(createPersonAccountRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.BasicResponse.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPersonAccount_Exception()
|
||||
{
|
||||
var createPersonAccountRequest = new CreatePersonAccountRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
FirstName = "Test",
|
||||
LastName = "Tester",
|
||||
BranchOrganizationNumber = 1
|
||||
};
|
||||
var accountMaintenanceResponse = new AccountMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.AddPersonAccount(createPersonAccountRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddOrganizationAccount_OK()
|
||||
{
|
||||
var createOrganizationAccountRequest = new CreateOrganizationAccountRequest()
|
||||
{
|
||||
OrganizationNumber = 1,
|
||||
BranchOrganizationNumber = 1
|
||||
};
|
||||
var accountMaintenanceResponse = new AccountMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Returns(accountMaintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.AddOrganizationAccount(createOrganizationAccountRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.BasicResponse.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddOrganizationAccount_Exception()
|
||||
{
|
||||
var createOrganizationAccountRequest = new CreateOrganizationAccountRequest()
|
||||
{
|
||||
OrganizationNumber = 1,
|
||||
BranchOrganizationNumber = 1
|
||||
};
|
||||
var accountMaintenanceResponse = new AccountMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.AddOrganizationAccount(createOrganizationAccountRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddOrganizationControllerPerson_OK()
|
||||
{
|
||||
var orgMaintenanceRequest = new OrganizationMaintenanceRequest()
|
||||
{
|
||||
OrganizationNumber = 1,
|
||||
ControllingPersonNumber = 1
|
||||
};
|
||||
var orgMaintenanceResponse = new OrgMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendOrgMaintenanceRequest(It.IsAny<OrgMaintenanceRequest>())).Returns(orgMaintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.AddOrganizationControlPerson(orgMaintenanceRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddOrganizationControllerPerson_Exception()
|
||||
{
|
||||
var orgMaintenanceRequest = new OrganizationMaintenanceRequest()
|
||||
{
|
||||
OrganizationNumber = 1,
|
||||
ControllingPersonNumber = 1
|
||||
};
|
||||
var orgMaintenanceResponse = new OrgMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendOrgMaintenanceRequest(It.IsAny<OrgMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.AddOrganizationControlPerson(orgMaintenanceRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountNickNameUpdateRequest_OK()
|
||||
{
|
||||
var accountRequest = new AccountNickNameUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
AccountDescription = "TestSuccess"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
var result = _service.SendAccountNickNameUpdateRequest(accountRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountNickNameUpdateRequest_Exception()
|
||||
{
|
||||
var accountRequest = new AccountNickNameUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
AccountDescription = "TestException"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.SendAccountNickNameUpdateRequest(accountRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountCreditReportTypeUpdateRequest_OK()
|
||||
{
|
||||
var accountRequest = new AccountCreditReportTypeUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
CreditReportType = "EXCL"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
var result = _service.SendAccountCreditReportTypeUpdateRequest(accountRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountCreditReportTypeUpdateRequest_Exception()
|
||||
{
|
||||
var accountRequest = new AccountCreditReportTypeUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
CreditReportType = "EXCL"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.SendAccountCreditReportTypeUpdateRequest(accountRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountContractDateUpdateRequest_OK()
|
||||
{
|
||||
var accountRequest = new AccountContractDateUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
ContractDate = DateTime.Now,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
var result = _service.SendAccountContractDateUpdateRequest(accountRequest);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SendAccountContractDateUpdateRequest_Exception()
|
||||
{
|
||||
var accountRequest = new AccountContractDateUpdateRequest()
|
||||
{
|
||||
AccountNumber = 1111111,
|
||||
ContractDate = DateTime.Now,
|
||||
};
|
||||
|
||||
var maintenanceResponse = new AccountMaintenanceResponse
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var basicResponse = new BasicResponse(maintenanceResponse);
|
||||
|
||||
_mockAccountDao.Setup(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.SendAccountContractDateUpdateRequest(accountRequest));
|
||||
_mockAccountDao.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class CollateralMaintenanceServiceTest
|
||||
{
|
||||
private CollateralMaintenanceService _service;
|
||||
private Mock<ICollateralMaintenanceDao> _mockCollateralDao;
|
||||
|
||||
public CollateralMaintenanceServiceTest()
|
||||
{
|
||||
_mockCollateralDao = new Mock<ICollateralMaintenanceDao>();
|
||||
_service = new CollateralMaintenanceService(_mockCollateralDao.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPropertyByPropertyNumber_OK()
|
||||
{
|
||||
var searchResponse = new CollateralSearchResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralDao.Setup(x => x.FindCollateralMaintenanceByPropertyNumber(100000)).Returns(searchResponse).Verifiable();
|
||||
|
||||
var result = _service.GetCollateralMaintenanceByPropertyNumber(100000);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPropertyByPropertyNumber_Exception()
|
||||
{
|
||||
_mockCollateralDao.Setup(x => x.FindCollateralMaintenanceByPropertyNumber(100000)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.GetCollateralMaintenanceByPropertyNumber(100000));
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
var fieldDetails = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 100000,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralDao.Setup(x => x.AddCollateralMaintenanceByPropertyNumber(It.IsAny<CollateralMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.InsertCollateralMaintenance(fieldDetails);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PostCollateralMaintenanceRequest_Exception()
|
||||
{
|
||||
var fieldDetails = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 100000,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
_mockCollateralDao.Setup(x => x.AddCollateralMaintenanceByPropertyNumber(It.IsAny<CollateralMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.InsertCollateralMaintenance(fieldDetails));
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutCollateralMaintenanceRequest_OK()
|
||||
{
|
||||
var fieldDetails = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 100000,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
var maintenanceResponse = new CollateralMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockCollateralDao.Setup(x => x.UpdateCollateralMaintenanceByPropertyNumber(It.IsAny<CollateralMaintenanceRequest>())).Returns(maintenanceResponse).Verifiable();
|
||||
|
||||
var result = _service.UpdateCollateralMaintenance(fieldDetails);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PutCollateralMaintenanceRequest_Exception()
|
||||
{
|
||||
var fieldDetails = new UserFieldRequest()
|
||||
{
|
||||
PropertyNumber = 100000,
|
||||
UserFieldCode = "TEST",
|
||||
Value = "TEST"
|
||||
};
|
||||
|
||||
_mockCollateralDao.Setup(x => x.UpdateCollateralMaintenanceByPropertyNumber(It.IsAny<CollateralMaintenanceRequest>())).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.UpdateCollateralMaintenance(fieldDetails));
|
||||
_mockCollateralDao.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Response;
|
||||
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class IndirectLoanServiceTest
|
||||
{
|
||||
private IndirectLoanService _service;
|
||||
private Mock<IIndirectLoanDao> _mockDao;
|
||||
private Mock<SoapConfiguration> _mockSoapConfiguration;
|
||||
private Mock<ICoreCmcConnection> _mockCoreCmcConnection;
|
||||
private const string AuthTypeToken = "3";
|
||||
|
||||
public IndirectLoanServiceTest()
|
||||
{
|
||||
_mockDao = new Mock<IIndirectLoanDao>();
|
||||
_mockSoapConfiguration = new Mock<SoapConfiguration>();
|
||||
_mockCoreCmcConnection = new Mock<ICoreCmcConnection>();
|
||||
|
||||
_mockSoapConfiguration.Object.RequestType = "16370";
|
||||
_mockSoapConfiguration.Object.IPAddress = "10.10.0.00";
|
||||
_mockSoapConfiguration.Object.PortId = 2500;
|
||||
_mockSoapConfiguration.Object.RequestType = "16340";
|
||||
_mockSoapConfiguration.Object.SocketApplicationId = "7726";
|
||||
_mockSoapConfiguration.Object.SocketDeviceId = "FULL";
|
||||
_mockSoapConfiguration.Object.AuthenticationType = "2";
|
||||
_mockSoapConfiguration.Object.SocketTimeout = 10000;
|
||||
|
||||
_service = new IndirectLoanService(_mockDao.Object, _mockCoreCmcConnection.Object, _mockSoapConfiguration.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateDealerOriginalBalancesRequest_OK()
|
||||
{
|
||||
var accountValue = new Cmc.Account()
|
||||
{
|
||||
AcctNbr = "11111111111"
|
||||
};
|
||||
|
||||
var accountRequest = new Cmc.AccountRequest()
|
||||
{
|
||||
Account = accountValue,
|
||||
ReqTypCd = _mockSoapConfiguration.Object.RequestType
|
||||
};
|
||||
|
||||
var userAuthentication = new Cmc.UserAuthentication()
|
||||
{
|
||||
AuthTyp = _mockSoapConfiguration.Object.AuthenticationType,
|
||||
ApplNbr = _mockSoapConfiguration.Object.SocketApplicationId,
|
||||
PhysAddr = _mockSoapConfiguration.Object.SocketDeviceId,
|
||||
UserId = "LOANORIG"
|
||||
//Passwd = "TESTTOKENSTRING" use without token for testing
|
||||
};
|
||||
|
||||
var requestsBase = new List<Cmc.AccountRequest>();
|
||||
requestsBase.Add(accountRequest);
|
||||
|
||||
var input = new Cmc.Input<Cmc.AccountRequest>()
|
||||
{
|
||||
UserAuthentication = userAuthentication,
|
||||
Requests = requestsBase
|
||||
};
|
||||
|
||||
var outputResponse = new Cmc.Response()
|
||||
{
|
||||
SuccessYN = "Y",
|
||||
Errors = new List<Cmc.Error>()
|
||||
};
|
||||
|
||||
var output = new Cmc.Output()
|
||||
{
|
||||
Responses = new List<Cmc.Response>() { outputResponse }
|
||||
};
|
||||
|
||||
var transaction = new Cmc.Transaction<Cmc.AccountRequest>()
|
||||
{
|
||||
Input = input,
|
||||
CommitRollbackYN = "Y",
|
||||
Output = output
|
||||
};
|
||||
|
||||
var account = "11111111111";
|
||||
|
||||
var response = new UpdateDealerOriginalBalanceResponse();
|
||||
_mockCoreCmcConnection.Setup(x => x.CreateSocketTransactionRequest<Cmc.AccountRequest>(It.IsAny<Cmc.AccountRequest>())).Returns(transaction);
|
||||
_mockDao.Setup(x => x.UpdateDealerOriginalBalance<Cmc.AccountRequest>(transaction)).Returns(transaction).Verifiable();
|
||||
|
||||
var result = _service.UpdateDealerOriginalBalances(account);
|
||||
Assert.IsNotNull(result);
|
||||
_mockCoreCmcConnection.Verify();
|
||||
_mockDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateDealerOriginalBalancesRequest_Exception()
|
||||
{
|
||||
var accountValue = new Cmc.Account()
|
||||
{
|
||||
AcctNbr = "11111111111"
|
||||
};
|
||||
|
||||
var accountRequest = new Cmc.AccountRequest()
|
||||
{
|
||||
Account = accountValue,
|
||||
ReqTypCd = _mockSoapConfiguration.Object.RequestType
|
||||
};
|
||||
|
||||
var userAuthentication = new Cmc.UserAuthentication()
|
||||
{
|
||||
AuthTyp = _mockSoapConfiguration.Object.AuthenticationType,
|
||||
ApplNbr = _mockSoapConfiguration.Object.SocketApplicationId,
|
||||
PhysAddr = _mockSoapConfiguration.Object.SocketDeviceId,
|
||||
UserId = "LOANORIG"
|
||||
//Passwd = "TESTTOKENSTRING" use without token for testing
|
||||
};
|
||||
|
||||
var requestsBase = new List<Cmc.AccountRequest>();
|
||||
requestsBase.Add(accountRequest);
|
||||
|
||||
var input = new Cmc.Input<Cmc.AccountRequest>()
|
||||
{
|
||||
UserAuthentication = userAuthentication,
|
||||
Requests = requestsBase
|
||||
};
|
||||
|
||||
var outputResponse = new Cmc.Response()
|
||||
{
|
||||
SuccessYN = "Y",
|
||||
//Errors = new List<Cmc.Error>()
|
||||
};
|
||||
|
||||
var output = new Cmc.Output()
|
||||
{
|
||||
Responses = new List<Cmc.Response>() { outputResponse }
|
||||
};
|
||||
|
||||
var transaction = new Cmc.Transaction<Cmc.AccountRequest>()
|
||||
{
|
||||
Input = input,
|
||||
CommitRollbackYN = "Y",
|
||||
Output = output
|
||||
};
|
||||
|
||||
var account = "11111111111111";
|
||||
_mockCoreCmcConnection.Setup(x => x.CreateSocketTransactionRequest<Cmc.AccountRequest>(It.IsAny<Cmc.AccountRequest>())).Returns(transaction);
|
||||
_mockDao.Setup(x => x.UpdateDealerOriginalBalance<Cmc.AccountRequest>(transaction)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.UpdateDealerOriginalBalances(account));
|
||||
_mockDao.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class MonetaryTranscationServiceTest
|
||||
{
|
||||
private MonetaryTransactionService _service;
|
||||
private Mock<IMonetaryTransactionDao> _mockDao;
|
||||
private Mock<SoapConfiguration> _mockSoapConfiguration;
|
||||
|
||||
public MonetaryTranscationServiceTest()
|
||||
{
|
||||
_mockDao = new Mock<IMonetaryTransactionDao>();
|
||||
_mockSoapConfiguration = new Mock<SoapConfiguration>();
|
||||
|
||||
_mockSoapConfiguration.Object.ApprovalPersonNumber = "5225";
|
||||
_mockSoapConfiguration.Object.OverrideCashBoxNumber = "800";
|
||||
|
||||
_service = new MonetaryTransactionService(_mockDao.Object, _mockSoapConfiguration.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddMonetaryTransactionsRequest_OK()
|
||||
{
|
||||
var groupRequest = new GroupedMonetaryTransactionRequest()
|
||||
{
|
||||
|
||||
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var response = new MonetaryTransactionResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
var listResponse = new List<MonetaryTransactionResponse> { response };
|
||||
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
|
||||
|
||||
_mockDao.Setup(x => x.AddMonetaryTransactions(groupRequest.MonetaryTransactionRequests)).Returns(listResponse).Verifiable();
|
||||
|
||||
var result = _service.AddMonetaryTransactions(listGroupRequest);
|
||||
Assert.IsNotNull(result);
|
||||
|
||||
_mockDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddMonetaryTransactionsRequest_Exception()
|
||||
{
|
||||
var groupRequest = new GroupedMonetaryTransactionRequest()
|
||||
{
|
||||
|
||||
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19618756535,
|
||||
RequestNumber = "1",
|
||||
TransactionTypeCode = "DEXP",
|
||||
|
||||
FundBalanceTypes = new FundBalanceType[1]
|
||||
{
|
||||
new FundBalanceType()
|
||||
{
|
||||
FundBalanceAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "IMED"
|
||||
}
|
||||
},
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = 1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = 1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
new MonetaryTransactionRequest()
|
||||
{
|
||||
AccountNumber = 19617805142,
|
||||
TransactionAmount = -1.25,
|
||||
ParentRequestNumber = "1",
|
||||
RequestNumber = "2",
|
||||
TransactionTypeCode = "DRIR",
|
||||
Description = "",
|
||||
|
||||
BalanceTypes = new BalanceType1[1] {
|
||||
new BalanceType1() {
|
||||
BalanceCategoryCode = "UPFR",
|
||||
BalanceTypeCode = "DLR",
|
||||
BalanceTypeAmount = -1.25
|
||||
}
|
||||
},
|
||||
|
||||
Funds = new Fund[1] {
|
||||
new Fund() {
|
||||
ClearingCategoryCode = "IMED",
|
||||
FundAmount = -1.25,
|
||||
FundTypeCode = "EL",
|
||||
FundTypeDetailCode = "INTR",
|
||||
NumberOfItems = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var response = new MonetaryTransactionResponse()
|
||||
{
|
||||
WasSuccessful = false
|
||||
};
|
||||
|
||||
var listResponse = new List<MonetaryTransactionResponse> { response };
|
||||
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
|
||||
|
||||
_mockDao.Setup(x => x.AddMonetaryTransactions(groupRequest.MonetaryTransactionRequests)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
Assert.ThrowsException<Exception>(() => _service.AddMonetaryTransactions(listGroupRequest));
|
||||
_mockDao.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class PersonAgreementServiceTest
|
||||
{
|
||||
private PersonAgreementService _service;
|
||||
private Mock<IPersonAgreementDao> _mockPersonAgreementDao;
|
||||
|
||||
public PersonAgreementServiceTest()
|
||||
{
|
||||
_mockPersonAgreementDao = new Mock<IPersonAgreementDao>();
|
||||
_service = new PersonAgreementService(_mockPersonAgreementDao.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdatePersonAgreementsDetailTypes_OK()
|
||||
{
|
||||
var response = new PersonAgreementMaintenanceResponse()
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockPersonAgreementDao.Setup(x => x.SendPersonAgreementMaintenanceRequest(It.IsAny<PersonAgreementMaintenanceRequest>()))
|
||||
.Returns(response).Verifiable();
|
||||
|
||||
var request = new PersonAgreementDetailTypeRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
AgreeNumber = 2,
|
||||
DetailTypes = new List<DetailType>()
|
||||
{
|
||||
new DetailType()
|
||||
{
|
||||
DetailTypeCode = "Stat",
|
||||
DetailValue = "CLOS"
|
||||
}
|
||||
}
|
||||
};
|
||||
var result = _service.UpdatePersonAgreementsDetailTypes(request);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.Success);
|
||||
_mockPersonAgreementDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdatePersonAgreementsDetailTypes_Exception()
|
||||
{
|
||||
_mockPersonAgreementDao.Setup(x => x.SendPersonAgreementMaintenanceRequest(It.IsAny<PersonAgreementMaintenanceRequest>()))
|
||||
.Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
var request = new PersonAgreementDetailTypeRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
AgreeNumber = 2,
|
||||
DetailTypes = new List<DetailType>()
|
||||
{
|
||||
new DetailType()
|
||||
{
|
||||
DetailTypeCode = "Stat",
|
||||
DetailValue = "CLOS"
|
||||
}
|
||||
}
|
||||
};
|
||||
Assert.ThrowsException<Exception>(() => _service.UpdatePersonAgreementsDetailTypes(request));
|
||||
_mockPersonAgreementDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdatePersonAgreementsDetailTypes_DetailTypes_Null_Exception()
|
||||
{
|
||||
var request = new PersonAgreementDetailTypeRequest()
|
||||
{
|
||||
PersonNumber = 1,
|
||||
AgreeNumber = 2,
|
||||
DetailTypes = null
|
||||
};
|
||||
Assert.ThrowsException<ArgumentNullException>(() => _service.UpdatePersonAgreementsDetailTypes(request));
|
||||
_mockPersonAgreementDao.Verify(x => x.SendPersonAgreementMaintenanceRequest(
|
||||
It.IsAny<PersonAgreementMaintenanceRequest>()), Times.Never);
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
||||
{
|
||||
[TestClass]
|
||||
public class TaxServicesTest
|
||||
{
|
||||
private readonly TaxService _service;
|
||||
private readonly Mock<ITaxDao> _mockTaxDao;
|
||||
|
||||
public TaxServicesTest()
|
||||
{
|
||||
_mockTaxDao = new Mock<ITaxDao>();
|
||||
_service = new TaxService(_mockTaxDao.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_OK()
|
||||
{
|
||||
var taxIdResponse = new GetTaxIdDataResponse
|
||||
{
|
||||
WasSuccessful = true
|
||||
};
|
||||
|
||||
_mockTaxDao.Setup(x => x.GetTaxIdData(1001)).Returns(taxIdResponse).Verifiable();
|
||||
|
||||
var result = _service.GetTaxIdData(1001);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue((bool)result.WasSuccessful);
|
||||
_mockTaxDao.Verify();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetTaxIdData_Exception()
|
||||
{
|
||||
_mockTaxDao.Setup(x => x.GetTaxIdData(1001)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
||||
|
||||
Assert.ThrowsException<Exception>(() => _service.GetTaxIdData(1001));
|
||||
_mockTaxDao.Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.9.2.0" newVersion="4.9.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Azure.Documents.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Serilog.Sinks.File" publicKeyToken="24c2f752a8e58a10" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Castle.Core" version="4.4.0" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net452" />
|
||||
<package id="Moq" version="4.16.1" targetFramework="net452" />
|
||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net452" />
|
||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net452" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net452" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user