public void TestReceivePackage_Successfully() { MockPackageRepository myMockPackageRepo = new MockPackageRepository(); PackageService packageService = new PackageService(myMockPackageRepo); Package package1 = MockDataAccess.GetPackage(3); DistributionCentre myReceiverCentre = MockDataAccess.GetDistributionCentre(3); int newTransitId = InsertMockTransit(package1, 2, 3); // insert transit packageService.Receive(package1.BarCode, myReceiverCentre, DateTime.Today); PackageTransit finishedTransit = MockDataAccess.GetPackageTransit(newTransitId); Debug.WriteLine(finishedTransit.ToString()); Assert.IsTrue(finishedTransit.IsPastTransit() && finishedTransit.ReceiverCentre == myReceiverCentre); }
public void TestDistribute_DistributedCurrentLocationError() { MockPackageRepository packageRepository = new MockPackageRepository(); PackageService _packageService = new PackageService(packageRepository); Employee emp = MockDataAccess.GetEmployee(2); Package p = MockDataAccess.GetPackage(3); p.CurrentStatus = PackageStatus.Distributed; p.CurrentLocation = MockDataAccess.GetDistributionCentre(4); Result result = _packageService.Distribute(p.BarCode, p.CurrentLocation, emp, p.ExpirationDate, p.PackageType, p.PackageId); Assert.AreEqual(false, result.Success); //Assert.AreEqual("Package has been already distributed: " + barCode, result.ErrorMessage); }
public Package GetPackage(int packageId) // (P. 05-04-2015) { return(MockDataAccess.GetPackage(packageId)); }