public void Init() { var unitOfWork = new Mock<IUnitOfWork>(); var giftCertificates = new List<GiftCertificate>() { new GiftCertificate() { StatusID = 1, ProgramID = 1, DonorID = 1, GiftCertificateID = 1, ETA = DateTime.Today, ReferenceNo = "REF-001", ShippingInstruction = new ShippingInstruction{ShippingInstructionID = 1,Value = "123/456"}, Vessel = "MRSEL", PortName = "Semera", IsPrinted = false, GiftDate = DateTime.Today, DModeOfTransport = 1, GiftCertificateDetails = new List<GiftCertificateDetail>() { new GiftCertificateDetail() { CommodityID = 1, BillOfLoading = "B-001", DBudgetTypeID = 1, WeightInMT = 12, DFundSourceID = 1, GiftCertificateID = 1, GiftCertificateDetailID = 2, TransactionGroupID = 1, } } } }; var giftCertificateRepositoy = new Mock<IGenericRepository<GiftCertificate>>(); giftCertificateRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<GiftCertificate, bool>>>(), It.IsAny<Func<IQueryable<GiftCertificate>, IOrderedQueryable<GiftCertificate>>>(), It.IsAny<string>())).Returns(giftCertificates); var transactionRepository = new Mock<IGenericRepository<Models.Transaction>>(); transactionRepository.Setup(t => t.Add(It.IsAny<Models.Transaction>())).Returns(true); var transactionGroupRepository = new Mock<IGenericRepository<TransactionGroup>>(); transactionGroupRepository.Setup(t => t.Add(It.IsAny<TransactionGroup>())).Returns(true); unitOfWork.Setup(t => t.GiftCertificateRepository).Returns(giftCertificateRepositoy.Object); unitOfWork.Setup(t => t.TransactionRepository).Returns(transactionRepository.Object); unitOfWork.Setup(t => t.TransactionGroupRepository).Returns(transactionGroupRepository.Object); unitOfWork.Setup(t => t.Save()); _accountTransactionService=new TransactionService(unitOfWork.Object); }
public void Init() { var unitOfWork = new Mock<IUnitOfWork>(); var giftCertificates = new List<GiftCertificate>() { new GiftCertificate() { StatusID = 1, ProgramID = 1, DonorID = 1, GiftCertificateID = 1, ETA = DateTime.Today, ReferenceNo = "REF-001", ShippingInstruction = new ShippingInstruction{ShippingInstructionID = 1,Value = "123/456"}, Vessel = "MRSEL", PortName = "Semera", IsPrinted = false, GiftDate = DateTime.Today, DModeOfTransport = 1, GiftCertificateDetails = new List<GiftCertificateDetail>() { new GiftCertificateDetail() { CommodityID = 1, BillOfLoading = "B-001", DBudgetTypeID = 1, WeightInMT = 12, DFundSourceID = 1, GiftCertificateID = 1, GiftCertificateDetailID = 2, TransactionGroupID = 1, } } } }; var giftCertificateRepositoy = new Mock<IGenericRepository<GiftCertificate>>(); giftCertificateRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<GiftCertificate, bool>>>(), It.IsAny<Func<IQueryable<GiftCertificate>, IOrderedQueryable<GiftCertificate>>>(), It.IsAny<string>())).Returns(giftCertificates); var sampleGUID = Guid.NewGuid(); var deliveryReconciles = new List<DeliveryReconcile>() { new DeliveryReconcile() { DeliveryReconcileID = 1, GRN = "123", FDPID = 1, DispatchID = sampleGUID, WayBillNo = "6554", RequsitionNo = "REQ-001", HubID = 1, GIN = "456", ReceivedAmount = (decimal)50.00, ReceivedDate = DateTime.Today, LossAmount = (decimal)0.00, LossReason = null, TransactionGroupID = sampleGUID, Dispatch = new Dispatch() { DispatchID = sampleGUID, PartitionID = 0, HubID = 1, GIN = "159", FDPID = 1, WeighBridgeTicketNumber = "984985", RequisitionNo = "REQ-001", BidNumber = "BID-123", TransporterID = 1, DriverName = "Abebe", PlateNo_Prime = "3-123456", PlateNo_Trailer = "3-123457", PeriodYear = 2014, PeriodMonth = 12, Round = 1, UserProfileID = 1, DispatchDate = DateTime.Now, CreatedDate = DateTime.Now, Remark = "sample remark", DispatchedByStoreMan = "Kebede", DispatchAllocationID = sampleGUID, OtherDispatchAllocationID = sampleGUID, DispatchAllocation = new DispatchAllocation() { DispatchAllocationID = sampleGUID, PartitionID = 0, HubID = 1, StoreID = 1, Year = 2014, Month = 12, Round = 1, DonorID = 1, ProgramID = 1, CommodityID = 1, RequisitionNo = "45328", BidRefNo = "REF-123", ContractStartDate = DateTime.Now, ContractEndDate = DateTime.Now, Beneficiery = 123, Amount = (decimal)123.45, Unit = 1, TransporterID = 1, FDPID = 1, ShippingInstructionID = 1, ProjectCodeID = 1, TransportOrderID = 1 }, DispatchDetails = new List<DispatchDetail>() { new DispatchDetail() { DispatchDetailID = sampleGUID, PartitionID = 0, TransactionGroupID = sampleGUID, DispatchID = sampleGUID, CommodityID = 1, RequestedQunatityInUnit = (decimal)123.45, UnitID = 1, RequestedQuantityInMT = (decimal)123.45, QuantityPerUnit = (decimal)123.45, Description = "Sample Description", }, new DispatchDetail() { DispatchDetailID = sampleGUID, PartitionID = 0, TransactionGroupID = sampleGUID, DispatchID = sampleGUID, CommodityID = 1, RequestedQunatityInUnit = (decimal)123.45, UnitID = 1, RequestedQuantityInMT = (decimal)123.45, QuantityPerUnit = (decimal)123.45, Description = "Sample Description", } }, FDP = new FDP() { FDPID = 1, Name = "FDP1", AdminUnitID = 1 }, Hub = new Models.Hub() { HubID = 1, Name = "Hub1", }, OtherDispatchAllocation = new OtherDispatchAllocation() { OtherDispatchAllocationID = sampleGUID }, Transporter = new Transporter() { TransporterID = 1, Name = "Sample Transporter" } }, FDP = new FDP() { FDPID = 1, Name = "FDP1", AdminUnitID = 1 }, Hub = new Models.Hub() { HubID = 1, Name = "Hub1", }, TransactionGroup =new TransactionGroup() { TransactionGroupID = sampleGUID } } }; var deliveryReconcileRepositoy = new Mock<IGenericRepository<DeliveryReconcile>>(); deliveryReconcileRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<DeliveryReconcile, bool>>>(), It.IsAny<Func<IQueryable<DeliveryReconcile>, IOrderedQueryable<DeliveryReconcile>>>(), It.IsAny<string>())).Returns(deliveryReconciles); var reliefRequisitions = new List<ReliefRequisition>() { new ReliefRequisition() { RequisitionID = 1, RequisitionNo = "REQ-001", Month = 12, ProgramID = 1, RegionalRequestID = 1, RegionalRequest = new RegionalRequest() { RegionalRequestID = 1 } }, new ReliefRequisition() { RequisitionID = 2, RequisitionNo = "REQ-002", Month = 11, ProgramID = 2, RegionalRequestID = 2, RegionalRequest = new RegionalRequest() { RegionalRequestID = 2 } } }; var reliefRequisitionRepositoy = new Mock<IGenericRepository<ReliefRequisition>>(); reliefRequisitionRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<ReliefRequisition, bool>>>(), It.IsAny<Func<IQueryable<ReliefRequisition>, IOrderedQueryable<ReliefRequisition>>>(), It.IsAny<string>())).Returns(reliefRequisitions); reliefRequisitionRepositoy.Setup(t => t.FindById(It.IsAny<int>())).Returns((int id) => reliefRequisitions. FirstOrDefault(t => t.RequisitionID == id)); var units = new List<Unit>() { new Unit() { UnitID = 1, Name = "Quintal" }, new Unit() { UnitID = 2, Name = "Kg" }, }; var unitRepositoy = new Mock<IGenericRepository<Unit>>(); unitRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<Unit, bool>>>(), It.IsAny<Func<IQueryable<Unit>, IOrderedQueryable<Unit>>>(), It.IsAny<string>())).Returns(units); var dispatches = new List<Dispatch>() { new Dispatch() { DispatchID = sampleGUID, PartitionID = 0, HubID = 1, GIN = "159", FDPID = 1, WeighBridgeTicketNumber = "984985", RequisitionNo = "REQ-001", BidNumber = "BID-123", TransporterID = 1, DriverName = "Abebe", PlateNo_Prime = "3-123456", PlateNo_Trailer = "3-123457", PeriodYear = 2014, PeriodMonth = 12, Round = 1, UserProfileID = 1, DispatchDate = DateTime.Now, CreatedDate = DateTime.Now, Remark = "sample remark", DispatchedByStoreMan = "Kebede", DispatchAllocationID = sampleGUID, OtherDispatchAllocationID = sampleGUID, DispatchAllocation = new DispatchAllocation() { DispatchAllocationID = sampleGUID, PartitionID = 0, HubID = 1, StoreID = 1, Year = 2014, Month = 12, Round = 1, DonorID = 1, ProgramID = 1, CommodityID = 1, RequisitionNo = "45328", BidRefNo = "REF-123", ContractStartDate = DateTime.Now, ContractEndDate = DateTime.Now, Beneficiery = 123, Amount = (decimal)123.45, Unit = 1, TransporterID = 1, FDPID = 1, ShippingInstructionID = 1, ProjectCodeID = 1, TransportOrderID = 1 }, DispatchDetails = new List<DispatchDetail>() { new DispatchDetail() { DispatchDetailID = sampleGUID, PartitionID = 0, TransactionGroupID = sampleGUID, DispatchID = sampleGUID, CommodityID = 1, RequestedQunatityInUnit = (decimal)123.45, UnitID = 1, RequestedQuantityInMT = (decimal)123.45, QuantityPerUnit = (decimal)123.45, Description = "Sample Description", }, new DispatchDetail() { DispatchDetailID = sampleGUID, PartitionID = 0, TransactionGroupID = sampleGUID, DispatchID = sampleGUID, CommodityID = 1, RequestedQunatityInUnit = (decimal)123.45, UnitID = 1, RequestedQuantityInMT = (decimal)123.45, QuantityPerUnit = (decimal)123.45, Description = "Sample Description", } }, FDP = new FDP() { FDPID = 1, Name = "FDP1", AdminUnitID = 1 }, Hub = new Models.Hub() { HubID = 1, Name = "Hub1", }, OtherDispatchAllocation = new OtherDispatchAllocation() { OtherDispatchAllocationID = sampleGUID }, Transporter = new Transporter() { TransporterID = 1, Name = "Sample Transporter" } }, }; var dispatchRepositoy = new Mock<IGenericRepository<Dispatch>>(); dispatchRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<Dispatch, bool>>>(), It.IsAny<Func<IQueryable<Dispatch>, IOrderedQueryable<Dispatch>>>(), It.IsAny<string>())).Returns(dispatches); var siPCAllocation = new List<SIPCAllocation>() { new SIPCAllocation() { SIPCAllocationID = 1, FDPID = 1, RequisitionDetailID = 1, Code = 0001245, AllocatedAmount = (decimal)123.45, AllocationType = "SI", ReliefRequisitionDetail = new ReliefRequisitionDetail() { RequisitionDetailID = 1, RequisitionID = 1, CommodityID = 1, BenficiaryNo = 123, Amount = (decimal)123.45, FDPID = 1, DonorID = 1, ReliefRequisition = new ReliefRequisition() { RequisitionID = 1, RequisitionNo = "REQ-001", Month = 12, ProgramID = 1, RegionID = 1, RegionalRequestID = 1, RegionalRequest = new RegionalRequest() { RegionalRequestID = 1, } }, } }, new SIPCAllocation() { SIPCAllocationID = 2, FDPID = 1, RequisitionDetailID = 1, Code = 0001246, AllocatedAmount = (decimal)123.45, AllocationType = "PC", ReliefRequisitionDetail = new ReliefRequisitionDetail() { RequisitionDetailID = 1, RequisitionID = 1, CommodityID = 1, BenficiaryNo = 123, Amount = (decimal)123.45, FDPID = 1, DonorID = 1, ReliefRequisition = new ReliefRequisition() { RequisitionID = 1, RequisitionNo = "REQ-001", Month = 12, ProgramID = 1, RegionID = 1, RegionalRequestID = 2, RegionalRequest = new RegionalRequest() { RegionalRequestID = 2, } }, } } }; var siPCAllocationRepositoy = new Mock<IGenericRepository<SIPCAllocation>>(); siPCAllocationRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<SIPCAllocation, bool>>>(), It.IsAny<Func<IQueryable<SIPCAllocation>, IOrderedQueryable<SIPCAllocation>>>(), It.IsAny<string>())).Returns(siPCAllocation); var shippingInstructions = new List<ShippingInstruction>() { new ShippingInstruction() { ShippingInstructionID = 1, Value = "0001245" }, new ShippingInstruction() { ShippingInstructionID = 1, Value = "0001246" }, }; var shippingInstructionRepositoy = new Mock<IGenericRepository<ShippingInstruction>>(); shippingInstructionRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<ShippingInstruction, bool>>>(), It.IsAny<Func<IQueryable<ShippingInstruction>, IOrderedQueryable<ShippingInstruction>>>(), It.IsAny<string>())).Returns(shippingInstructions); var projectCodes = new List<ProjectCode>() { new ProjectCode() { ProjectCodeID = 1, Value = "0001245" }, new ProjectCode() { ProjectCodeID = 1, Value = "0001246" }, }; var projectCodeRepositoy = new Mock<IGenericRepository<ProjectCode>>(); projectCodeRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<ProjectCode, bool>>>(), It.IsAny<Func<IQueryable<ProjectCode>, IOrderedQueryable<ProjectCode>>>(), It.IsAny<string>())).Returns(projectCodes); var regionalPSNPPlans = new List<RegionalPSNPPlan>() { new RegionalPSNPPlan() { RegionalPSNPPlanID = 1, Year = 2014, Duration = 5, RationID = 1, StatusID = 1, PlanId = 1, RegionalPSNPPlanDetails = new List<RegionalPSNPPlanDetail>() { new RegionalPSNPPlanDetail() { RegionalPSNPPlanDetailID = 1, RegionalPSNPPlanID = 1, PlanedFDPID = 1, BeneficiaryCount = 200, FoodRatio = 3, CashRatio = 3, Item3Ratio = 0, Item4Ratio = 0 } } } }; var regionalPSNPPlanRepositoy = new Mock<IGenericRepository<RegionalPSNPPlan>>(); regionalPSNPPlanRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<RegionalPSNPPlan, bool>>>(), It.IsAny<Func<IQueryable<RegionalPSNPPlan>, IOrderedQueryable<RegionalPSNPPlan>>>(), It.IsAny<string>())).Returns(regionalPSNPPlans); var rations = new List<Ration>() { new Ration() { RationID = 1, CreatedDate = DateTime.Now, IsDefaultRation = true, RefrenceNumber = "Ration-Default", RationDetails = new List<RationDetail>() { new RationDetail() { RationDetailID = 1, RationID =1, CommodityID = 1, Amount = 20, }, new RationDetail() { RationDetailID = 2, RationID =1, CommodityID = 2, Amount = 20, } } } }; var rationRepositoy = new Mock<IGenericRepository<Ration>>(); rationRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<Ration, bool>>>(), It.IsAny<Func<IQueryable<Ration>, IOrderedQueryable<Ration>>>(), It.IsAny<string>())).Returns(rations); var hrds = new List<HRD>() { new HRD() { HRDID = 1, Year = 2014, CreatedDate = DateTime.Now, PublishedDate = DateTime.Now, RationID = 1, PlanID = 1, Ration = new Ration() { RationID = 1, CreatedDate = DateTime.Now, IsDefaultRation = true, RefrenceNumber = "Ration-Default", RationDetails = new List<RationDetail>() { new RationDetail() { RationDetailID = 1, RationID = 1, CommodityID = 1, Amount = 20, }, new RationDetail() { RationDetailID = 2, RationID = 1, CommodityID = 2, Amount = 20, } }, }, HRDDetails = new List<HRDDetail>() { new HRDDetail() { HRDDetailID = 1, HRDID = 1, WoredaID = 3, NumberOfBeneficiaries = 123, DurationOfAssistance = 6, StartingMonth = 6, AdminUnit = new AdminUnit() { AdminUnitID = 3, Name = "Woreda1", AdminUnitTypeID = 4, AdminUnit2 = new AdminUnit() { AdminUnitID = 2, Name = "Zone1", AdminUnitTypeID = 3, AdminUnit2 = new AdminUnit () { AdminUnitID = 1, Name = "Region1", AdminUnitTypeID = 2, } } } } } } }; var hrdRepositoy = new Mock<IGenericRepository<HRD>>(); hrdRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<HRD, bool>>>(), It.IsAny<Func<IQueryable<HRD>, IOrderedQueryable<HRD>>>(), It.IsAny<string>())).Returns(hrds); var woredaStockDistributions = new List<WoredaStockDistribution>() { new WoredaStockDistribution() { WoredaStockDistributionID = 1, WoredaID = 1, ProgramID = 1, PlanID = 1, Month = 1, SupportTypeID = 1, ActualBeneficairies = 500, DistributionDate = DateTime.Now, DistributedBy = 1, Remark = "Sample remark", MaleLessThan5Years = 100, FemaleLessThan5Years = 100, MaleBetween5And18Years = 100, FemaleBetween5And18Years = 100, MaleAbove18Years = 50, FemaleAbove18Years = 50, WoredaStockDistributionDetails = new List<WoredaStockDistributionDetail>() { new WoredaStockDistributionDetail() { WoredaStockDistributionDetailID = 1, WoredaStockDistributionID = 1, FdpId = 1, DistributedAmount = 100, StartingBalance = 100, EndingBalance = 20, TotalIn = 100, TotoalOut = 80, DistributionStartDate = DateTime.Now, DistributionEndDate = DateTime.Today.AddDays(10), LossAmount = 10, LossReason = "Rat intrusion", FDP = new FDP() { FDPID = 1, Name = "FDP1", AdminUnitID = 1 }, } } } }; var woredaStockDistributionRepositoy = new Mock<IGenericRepository<WoredaStockDistribution>>(); woredaStockDistributionRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<WoredaStockDistribution, bool>>>(), It.IsAny<Func<IQueryable<WoredaStockDistribution>, IOrderedQueryable<WoredaStockDistribution>>>(), It.IsAny<string>())).Returns(woredaStockDistributions); var donationPlanHeaders = new List<DonationPlanHeader>() { new DonationPlanHeader() { DonationHeaderPlanID = 1, ShippingInstructionId = 1, CommodityID = 1, DonatedAmount = 500, DonorID = 1, ProgramID = 1, ETA = DateTime.Today.AddDays(10), Vessel = "Vessel-123", ReferenceNo = "REF-123", Remark = "Sample Remark", DonationPlanDetails = new List<DonationPlanDetail>() { new DonationPlanDetail() { DonationDetailPlanID = 1, DonationHeaderPlanID = 1, HubID = 1, AllocatedAmount = 500, ReceivedAmount = 450, Balance = 50, Hub = new Models.Hub() { HubID = 1, Name = "Hub1" } } } } }; var donationPlanHeaderRepositoy = new Mock<IGenericRepository<DonationPlanHeader>>(); donationPlanHeaderRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<DonationPlanHeader, bool>>>(), It.IsAny<Func<IQueryable<DonationPlanHeader>, IOrderedQueryable<DonationPlanHeader>>>(), It.IsAny<string>())).Returns(donationPlanHeaders); donationPlanHeaderRepositoy.Setup(t => t.FindById(It.IsAny<int>())).Returns((int id) => donationPlanHeaders. FirstOrDefault(t => t.DonationHeaderPlanID == id)); var transactionRepository = new Mock<IGenericRepository<Models.Transaction>>(); transactionRepository.Setup(t => t.Add(It.IsAny<Models.Transaction>())).Returns(true); var transactionGroupRepository = new Mock<IGenericRepository<TransactionGroup>>(); transactionGroupRepository.Setup(t => t.Add(It.IsAny<TransactionGroup>())).Returns(true); unitOfWork.Setup(t => t.GiftCertificateRepository).Returns(giftCertificateRepositoy.Object); unitOfWork.Setup(t => t.DeliveryReconcileRepository).Returns(deliveryReconcileRepositoy.Object); unitOfWork.Setup(t => t.ReliefRequisitionRepository).Returns(reliefRequisitionRepositoy.Object); unitOfWork.Setup(t => t.DispatchRepository).Returns(dispatchRepositoy.Object); unitOfWork.Setup(t => t.UnitRepository).Returns(unitRepositoy.Object); unitOfWork.Setup(t => t.SIPCAllocationRepository).Returns(siPCAllocationRepositoy.Object); unitOfWork.Setup(t => t.ShippingInstructionRepository).Returns(shippingInstructionRepositoy.Object); unitOfWork.Setup(t => t.ProjectCodeRepository).Returns(projectCodeRepositoy.Object); unitOfWork.Setup(t => t.RegionalPSNPPlanRepository).Returns(regionalPSNPPlanRepositoy.Object); unitOfWork.Setup(t => t.RationRepository).Returns(rationRepositoy.Object); unitOfWork.Setup(t => t.HRDRepository).Returns(hrdRepositoy.Object); unitOfWork.Setup(t => t.DonationPlanHeaderRepository).Returns(donationPlanHeaderRepositoy.Object); unitOfWork.Setup(t => t.WoredaStockDistributionRepository).Returns(woredaStockDistributionRepositoy.Object); unitOfWork.Setup(t => t.TransactionRepository).Returns(transactionRepository.Object); unitOfWork.Setup(t => t.TransactionGroupRepository).Returns(transactionGroupRepository.Object); unitOfWork.Setup(t => t.Save()); _accountTransactionService=new TransactionService(unitOfWork.Object); }
public void Init() { var unitOfWork = new Mock<IUnitOfWork>(); var commodities = new List<Commodity>() { new Commodity() { CommodityID = 1, Name = "Commodity1" }, new Commodity() { CommodityID = 2, Name = "Commodity2" } }; var transporters = new List<Transporter>() { new Transporter() { TransporterID = 1, Name = "Transporter1" }, new Transporter() { TransporterID = 2, Name = "Transporter2" } }; var units = new List<Unit>() { new Unit() { UnitID = 1, Name = "Unit1" }, new Unit() { UnitID = 2, Name = "Unit2" } }; var fdps = new List<FDP>() { new FDP() { FDPID = 1, Name = "FDP1" }, new FDP() { FDPID = 2, Name = "FDP2" } }; var programs = new List<Program>() { new Program() { ProgramID = 1, Name = "Program1" }, new Program() { ProgramID = 2, Name = "Program2" } }; var regions = new List<AdminUnit>() { new AdminUnit() { AdminUnitID = 1, Name = "AdminUnit1" }, new AdminUnit() { AdminUnitID = 2, Name = "AdminUnit2" } }; var zones = new List<AdminUnit>() { new AdminUnit() { AdminUnitID = 3, Name = "AdminUnit3" }, new AdminUnit() { AdminUnitID = 4, Name = "AdminUnit4" } }; var stores = new List<Store>() { new Store() { StoreID = 1, Name = "Store1" }, new Store() { StoreID = 2, Name = "Store2" } }; var dispatchModels = new List<DispatchModel>() { new DispatchModel(commodities,transporters,units,fdps,programs,regions,zones,stores) { } }; var dispatchModelRepositoy = new Mock<IGenericRepository<DispatchModel>>(); dispatchModelRepositoy.Setup( t => t.Get(It.IsAny<Expression<Func<DispatchModel, bool>>>(), It.IsAny<Func<IQueryable<DispatchModel>, IOrderedQueryable<DispatchModel>>>(), It.IsAny<string>())).Returns(dispatchModels); dispatchModelRepositoy.Setup(t => t.FindById(It.IsAny<Guid>())).Returns((Guid id) => dispatchModels. FirstOrDefault(t => t.DispatchID == id)); var transactionRepository = new Mock<IGenericRepository<Models.Transaction>>(); transactionRepository.Setup(t => t.Add(It.IsAny<Models.Transaction>())).Returns(true); var transactionGroupRepository = new Mock<IGenericRepository<TransactionGroup>>(); transactionGroupRepository.Setup(t => t.Add(It.IsAny<TransactionGroup>())).Returns(true); //unitOfWork.Setup(t => t.DispatchRepositoy).Returns(dispatchModelRepositoy.Object); unitOfWork.Setup(t => t.TransactionRepository).Returns(transactionRepository.Object); unitOfWork.Setup(t => t.TransactionGroupRepository).Returns(transactionGroupRepository.Object); unitOfWork.Setup(t => t.Save()); _hubTransactionService = new TransactionService(unitOfWork.Object); }