예제 #1
0
        public void TestDistributeExpiredPackages()
        {
            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 PackageDistributeViewModel()
            {
                SelectedPackages = spList,
            };

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

            var modelReturned = result.Model as PackageDistributeViewModel;

            Assert.AreEqual("DistributeComplete", result.ViewName);
            Assert.AreEqual(PackageResult.PackageHasExpired, modelReturned.SelectedPackages[0].ProcessResultMessage);
        }