public async Task AddTransactionPriority_ForFacilityId_Positive_Test() { //Arrange var objTransactionPriorityPost = new TransactionPriorityPost() { PriorityCode = "TPCode", PriorityName = "TPDescription", ForManualPickFlag = true, ForManualRestockFlag = true, UseInterfaceMedNameFlag = true, ADUFlag = true, LegendForeColor = "ForeColor", LegendBackColor = "backColor", ActiveFlag = true }; Dictionary <string, string> headers = new Dictionary <string, string>(); List <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority> listTransactionPriority = new List <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority>() { }; SiteConfiguration.API.TransactionPriority.Models.TransactionPriority objTransactionPriority = new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }; listTransactionPriority.Add(objTransactionPriority); _transactionPriorityRepository.Setup(x => x.GetAll()).Returns(listTransactionPriority); _transactionPriorityRepository.Setup(x => x.AddAsync(It.IsAny <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority>())).Returns(Task.CompletedTask); TransactionPriorityManager objTransactionPriorityManager = new TransactionPriorityManager(_transactionPriorityRepository.Object, _executionContextAccessor , _unitOfWork.Object, _logger.Object, _transactionPrioritySmartSortRepository.Object, _smartSortRepository.Object, _eventbus.Object , _option.Object, _mapper.Object); //Act var response = await objTransactionPriorityManager.AddTransactionPriority(objTransactionPriorityPost, new Guid("c33e0be3-ef34-4a69-9f48-3a19de0dc649"), headers); Assert.Equal(response.IsSuccesss, true); }
public async Task GetSmartSortForTransactionPriority_ForTransactionPriorityKeyfacilityIDId_TransactionPrioritySmartSortExist_Positive_Test() { //Arrange SiteConfiguration.API.TransactionPriority.Models.TransactionPriority objTransactionPriority = new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }; _transactionPriorityRepository.Setup(x => x.GetByTransactionPriorityAndFacilityKey(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(objTransactionPriority); IEnumerable <TransactionPrioritySmartSort> listTransactionPrioritySmartSort = new List <TransactionPrioritySmartSort>(); Task <IEnumerable <TransactionPrioritySmartSort> > listTaskTransactionPrioritySmartSort = Task.FromResult <IEnumerable <TransactionPrioritySmartSort> >(listTransactionPrioritySmartSort); _transactionPrioritySmartSortRepository.Setup(x => x.GetSmartSortForTransactionPriorityAsync(It.IsAny <Guid>())).Returns(listTaskTransactionPrioritySmartSort); TransactionPriorityManager objTransactionPriorityManager = new TransactionPriorityManager(_transactionPriorityRepository.Object, _executionContextAccessor , _unitOfWork.Object, _logger.Object, _transactionPrioritySmartSortRepository.Object, _smartSortRepository.Object, _eventbus.Object , _option.Object, _mapper.Object); IEnumerable <TransactionPrioritySmartSort> transactionPrioritySmartSortsExpected = null; //Act var response = await objTransactionPriorityManager.GetSmartSortForTransactionPriority("c17b8f8c-ffbf-4edf-861e-ee48040e7ca7", "c17b8f8c-ffbf-4edf-861e-ee48040e7ca7"); //Assert Assert.Equal(listTransactionPrioritySmartSort, response); }
public async Task UpdateTransactionPriorityAsync_TransactionPriorityId_FacilityId_TransactionPriorityObject_Positive_Test() { //Arrange Dictionary <string, string> headers = new Dictionary <string, string>(); SiteConfiguration.API.TransactionPriority.Models.TransactionPriority objTransactionPriority = new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }; _transactionPriorityRepository.Setup(x => x.GetByTransactionPriorityAndFacilityKey(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(objTransactionPriority); _transactionPriorityRepository.Setup(x => x.Update(It.IsAny <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority>())); TransactionPriorityPut objTransactionPriorityPut = new TransactionPriorityPut() { PriorityOrder = 1 }; TransactionPriorityManager objTransactionPriorityManager = new TransactionPriorityManager(_transactionPriorityRepository.Object, _executionContextAccessor , _unitOfWork.Object, _logger.Object, _transactionPrioritySmartSortRepository.Object, _smartSortRepository.Object, _eventbus.Object , _option.Object, _mapper.Object); //Act var response = await objTransactionPriorityManager.UpdateTransactionPriorityAsync("c17b8f8c-ffbf-4edf-861e-ee48040e7ca7", objTransactionPriorityPut, new Guid("c33e0be3-ef34-4a69-9f48-3a19de0dc649"), headers); //Assert Assert.Equal(response.IsSuccesss, true); }
public async Task GetAllSerachedTransactionPriorityAsync_WithRespectToOffsetLimitFacility_Posiitve_Test() { //Arrange List <TransactionPriorityGet> listTransactionPriorityGet = new List <TransactionPriorityGet>(); listTransactionPriorityGet.Add(new TransactionPriorityGet() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }); IEnumerable <TransactionPriorityGet> ienumrableTransactionPriorityGet = listTransactionPriorityGet; List <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority> listTransactionPriority = new List <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority>(); SiteConfiguration.API.TransactionPriority.Models.TransactionPriority objTransactionPriority = new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }; listTransactionPriority.Add(objTransactionPriority); Task <IEnumerable <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority> > listTaskTransactionPriority = Task.FromResult <IEnumerable <SiteConfiguration.API.TransactionPriority.Models.TransactionPriority> >(listTransactionPriority); _transactionPriorityRepository.Setup(x => x.GetAllSerachedTransactionPriorityAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <Guid>())).Returns(listTaskTransactionPriority); TransactionPriorityManager objTransactionPriorityManager = new TransactionPriorityManager(_transactionPriorityRepository.Object, _executionContextAccessor , _unitOfWork.Object, _logger.Object, _transactionPrioritySmartSortRepository.Object, _smartSortRepository.Object, _eventbus.Object , _option.Object, _mapper.Object); //Act var response = await objTransactionPriorityManager.GetAllSerachedTransactionPriorityAsync("TPDescription", 1, 1, "c17b8f8c-ffbf-4edf-861e-ee48040e7ca7"); //Assert Assert.Equal((ienumrableTransactionPriorityGet.ToList()[0]).PriorityCode, (response.ToList()[0]).PriorityCode); }
public void GetTransactionPriorityById_Negative_Test() { //Arrange SiteConfiguration.API.TransactionPriority.Models.TransactionPriority objTransactionPriority = new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority() { PriorityCode = "TPCodeOld", PriorityOrder = 1 }; _transactionPriorityRepository.Setup(x => x.Get(Guid.Parse("c17b8f8c-ffbf-4edf-861e-ee48040e7ca7"))).Returns(objTransactionPriority); TransactionPriorityManager objTransactionPriorityManager = new TransactionPriorityManager(_transactionPriorityRepository.Object, _executionContextAccessor , _unitOfWork.Object, _logger.Object, _transactionPrioritySmartSortRepository.Object, _smartSortRepository.Object, _eventbus.Object , _option.Object, _mapper.Object); //Act var expected = objTransactionPriorityManager.GetTransactionPriorityById("c17b8f8c-ffbf-4edf-861e-ee48040e7ca7"); //Assert Assert.NotEqual(expected, new SiteConfiguration.API.TransactionPriority.Models.TransactionPriority()); }