示例#1
0
        public void TestDiscardPackageExpired()
        {
            IPackageRepository  packageRepository  = new MockPackageRepository();
            IEmployeeRepository employeeRepository = new MockEmployeeRepository();
            var controller = new PackageController(employeeRepository, packageRepository);

            Package package = packageRepository.GetPackageWidthBarCode("65985438786");

            List <SelectedPackage> spList = new List <SelectedPackage>();

            SelectedPackage sp = new SelectedPackage();

            sp.BarCode                 = package.BarCode;
            sp.CentreId                = package.CurrentLocation.CentreId;
            sp.ExpirationDate          = package.ExpirationDate;
            sp.PackageId               = package.PackageId;
            sp.PackageTypeId           = package.PackageType.PackageTypeId;
            sp.CurrentEmployeeUserName = "******";

            spList.Add(sp);

            var model = new PackageDiscardViewModel()
            {
                SelectedPackages = spList,
            };

            var result = controller.DiscardSave(model) as ViewResult;

            var modelReturned = result.Model as PackageDiscardViewModel;

            Assert.AreEqual("DiscardComplete", result.ViewName);
            Assert.AreEqual("Succeeded", modelReturned.SelectedPackages[0].ProcessResultMessage);
        }