public void RunBeforeTests() { //setup branch plant branchPlant bp = new branchPlant(); itemBranch ib = new itemBranch(); item i = new item(); entity1 s = new entity1(); i.itemId = 740498; i.itemProduct = "40970"; s.entityId = 888; ib.branchPlant = "850001"; ib.stockingTypeCode = "P"; ib.primaryUnitOfMeasureCode = "EA"; ib.dateLIFO= new DateTime(2015,06,17); //sprint end date :) ib.supplier = s; bp.itemBranch = ib; bp.item = i; plantArray[0] = bp; //Setup Price itemResponseSupplier ir = new itemResponseSupplier(); ir.itemId = 740498; ir.itemProduct = "40970"; supplierCatalogPrice scp = new supplierCatalogPrice(); scp.priceUnit = 12.87m; scp.priceUnitSpecified = true; scp.quantityActual = 0; scp.quantityActualSpecified = true; scp.item = ir; supplierCatalogPriceArray[0] = scp; //Setup calculated availability itemGroupCustomer igc = new itemGroupCustomer(); igc.itemId = 740498; igc.itemProduct = "40970"; igc.itemDescription = "MRG SF Iowa Branch Plant"; igc.itemUOMPrimary = "UGC"; igc.itemUOMSecondary = "UGC"; igc.itemCatalog = "40970"; igc.itemIdSpecified = true; availabilitySummary avs = new availabilitySummary(); availabilityDetails[] ad = new availabilityDetails[2]; mathNumeric mn = new mathNumeric(); availabilityDetails avdet = new availabilityDetails(); mn.value = 5000; avdet.availableQuantity = mn; avdet.businessUnit = "850001"; avdet.glCategory = "IN30"; avdet.location = "13-09-01-AA-02"; avdet.primaryBin = "S"; ad[0] = avdet; mn = new mathNumeric(); avdet = new availabilityDetails(); mn.value = 0; avdet.availableQuantity = mn; avdet.businessUnit = "850001"; avdet.glCategory = "IN30"; avdet.location = "R - - - - "; avdet.primaryBin = "P"; ad[1] = avdet; avs.availabilityDetails = ad; avs.businessUnit = "850001"; avs.businessUnitDesc = "MRG SF Iowa Branch Plant"; _availabilitySummary[0] = avs; _inventoryManager = Substitute.For<IInventoryManager>(); //set return value for GetBranchPlantItem method call _inventoryManager.GetBranchPlantItem(Arg.Any<getBranchPlantItem>()) .Returns(new showBranchPlantItem { branchPlant = plantArray }); //set return value for GetSupplierCatalogPrice method call _inventoryManager.GetSupplierCatalogPrice(Arg.Any<getSupplierCatalogPrice>()) .Returns(new showSupplierCatalogPrice { supplierCatalogPrice = supplierCatalogPriceArray }); //set return value for calculated availability. _inventoryManager.GetCalculatedAvailability(Arg.Any<getCalculatedAvailability>()) .Returns(new showCalculatedAvailability { item = igc, totalQtyAvailable = 5000, totalQtyAvailableSpecified = true, unitOfMeasure = "EA", showCalculatedAvailability1 = _availabilitySummary }); //instantiate repo _prodRepo = new ProductRepository(_inventoryManager); }