public void TestReceivedPackagePage_Distributed() { var controller = new PackageTransitController(employeeRepository, packageRepository); controller.ControllerContext = new ENetCareMVC.UnitTest.FakeClasses.FakeControllerContext(controller, "*****@*****.**", new string[] { "Agent" }); Package package = packageRepository.GetPackageWidthBarCode("11623542734"); List <SelectedPackage> spList = new List <SelectedPackage>(); SelectedPackage sp = new SelectedPackage() { BarCode = package.BarCode }; spList.Add(sp); var model = new PackageTransitReceiveViewModel() { SelectedPackages = spList, BarCode = package.BarCode, ReceiveDate = DateTime.Today }; var result = controller.ReceiveSave(model) as ViewResult; var modelReturned = result.Model as PackageTransitReceiveViewModel; Assert.AreEqual("ReceiveComplete", result.ViewName); Assert.AreEqual("Successful!", modelReturned.SelectedPackages[0].ProcessResultMessage); }
public void TestReceivePackagePage_Initialized() { var controller = new PackageTransitController(employeeRepository, packageRepository); var result = controller.Receive() as ViewResult; var model = result.Model as PackageTransitReceiveViewModel; Assert.AreEqual(string.Empty, result.ViewName); Assert.IsNotNull(model.SelectedPackages); }
public void TestSendPackagePage_InTransit() { var controller = new PackageTransitController(employeeRepository, packageRepository); controller.ControllerContext = new ENetCareMVC.UnitTest.FakeClasses.FakeControllerContext(controller, "*****@*****.**", new string[] { "Agent" }); Package package = packageRepository.GetPackageWidthBarCode("13154242431"); DistributionCentre destinationLocation = new DistributionCentre() { CentreId = 1, Name = "mainCentre" }; List <SelectedPackage> spList = new List <SelectedPackage>(); SelectedPackage sp = new SelectedPackage() { BarCode = package.BarCode, CentreId = package.CurrentLocation.CentreId, }; spList.Add(sp); var model = new PackageTransitSendViewModel() { SelectedPackages = spList, DestinationCentreId = destinationLocation.CentreId, BarCode = package.BarCode, SendDate = DateTime.Today }; var result = controller.SendSave(model) as ViewResult; var modelReturned = result.Model as PackageTransitSendViewModel; //TransitResult.PackageAlreadyAtDestination Assert.AreEqual("SendComplete", result.ViewName); Assert.AreEqual(PackageResult.PackageIsNotInStock, modelReturned.SelectedPackages[0].ProcessResultMessage); }