public async Task UpdatePrinter_ValidRequest_ShouldCommit() { //Arrange var guid = Guid.Parse("BF521211-CEAF-4DCA-82C7-40446D4C46ED"); var fakePrinter = new SiteConfiguration.API.Printers.Models.Data.Printer { PrinterKey = guid, PrinterModelKey = guid }; var fakePrinterModel = new SiteConfiguration.API.Printers.Models.Data.PrinterModel { PrinterModelKey = guid }; var fakePrinterRequest = new PrinterRequest(); _printerRepository.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(fakePrinter); _printerModelRepository.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(fakePrinterModel); //Act await printerBusiness.UpdatePrinter(guid, guid, fakePrinterRequest); //Assert _unitOfWork.Verify(x => x.CommitChanges(), Times.Once); }
public async Task AddPrinterKey_ValidRequest_ShouldCommit() { //Arrange var guid = Guid.Parse("BF521211-CEAF-4DCA-82C7-40446D4C46ED"); var fakeRequest = new PrinterRequest(); var fakeprintermodel = new SiteConfiguration.API.Printers.Models.Data.PrinterModel { PrinterModelKey = Guid.NewGuid(), DescriptionText = "testdescription" }; _printerModelRepository.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(fakeprintermodel); //Act await printerBusiness.AddPrinter(fakeRequest, guid); //Assert _unitOfWork.Verify(x => x.CommitChanges(), Times.Once); }
public async Task GetPrinterModelsByFacility_ValidFacilityKey_ShouldReturnPrinterModels() { //Arrange var guid = Guid.Parse("BF521211-CEAF-4DCA-82C7-40446D4C46ED"); var fakePrinterModels = new SiteConfiguration.API.Printers.Models.Data.PrinterModel { PrinterModelKey = guid, DescriptionText = "testdescription" }; var mockList = new List <SiteConfiguration.API.Printers.Models.Data.PrinterModel>(); mockList.Add(fakePrinterModels); _printerModelRepository.Setup(x => x.GetAllAsync()).ReturnsAsync(mockList); //Act var response = await printerBusiness.GetPrinterModels(); //Assert Assert.Equal(guid, response.First().Id); }