public async Task GetLoaderInternNote_Return_InternalServerError() { //Arrange var mocks = GetMocks(); GarmentPurchasingPphBankExpenditureNoteLoaderInternNote data = new GarmentPurchasingPphBankExpenditureNoteLoaderInternNote() { Name = "" }; mocks.Service .Setup(f => f.GetLoaderInterNotePPH(It.IsAny <string>())) .Throws(new Exception()); var controller = GetController(mocks); //Act GarmentPurchasingPphBankExpenditureNoteFilterReportDto filter = new GarmentPurchasingPphBankExpenditureNoteFilterReportDto() { DateEnd = DateTime.Now.AddDays(2), DateStart = DateTime.Now.AddDays(-1), INNo = "INNo", InvoiceNo = "InvoiceNo", InvoiceOutNo = "InvoiceOutNo", SupplierName = "SupplierName" }; var response = await controller.DownloadReportXls(filter, 1, 25, "{}"); //Assert int statusCode = GetStatusCode(response); Assert.Equal((int)HttpStatusCode.InternalServerError, statusCode); }
public async Task GetLoaderInternNote_Return_OK() { //Arrange var mocks = GetMocks(); GarmentPurchasingPphBankExpenditureNoteLoaderInternNote data = new GarmentPurchasingPphBankExpenditureNoteLoaderInternNote() { Name = "" }; mocks.Service .Setup(f => f.GetLoaderInterNotePPH(It.IsAny <string>())) .Returns(new List <GarmentPurchasingPphBankExpenditureNoteLoaderInternNote>() { data }); var controller = GetController(mocks); //Act GarmentPurchasingPphBankExpenditureNoteFilterReportDto filter = new GarmentPurchasingPphBankExpenditureNoteFilterReportDto() { DateEnd = DateTime.Now.AddDays(2), DateStart = DateTime.Now.AddDays(-1), INNo = "INNo", InvoiceNo = "InvoiceNo", InvoiceOutNo = "InvoiceOutNo", SupplierName = "SupplierName" }; var response = await controller.GetLoaderInternNote(""); //Assert int statusCode = GetStatusCode(response); Assert.Equal((int)HttpStatusCode.OK, statusCode); }