Exemple #1
0
        private Result DiscardPackage(int currentCentreId, string userName, string barCode)
        {
            MockPackageRepository packageRepository = new MockPackageRepository();
            PackageService        _packageService   = new PackageService(packageRepository);
            Employee employee = MockDataAccess.GetEmployee(userName);
            Package  package  = MockDataAccess.GetPackage(barCode);

            package.CurrentLocation = MockDataAccess.GetDistributionCentre(currentCentreId);
            StandardPackageType spt2 = _packageService.GetStandardPackageType(package.PackageType.PackageTypeId);

            return(_packageService.Discard(package.BarCode, employee.Location, employee, package.ExpirationDate, spt2, package.PackageId));
        }
Exemple #2
0
        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);
        }