public ActionResult Cancel(Guid ID)
        {
            BusinessTripRepository btr = new BusinessTripRepository();
            var bt = btr.GetBtById(ID);

            bt.Cancel();
            return(View(bt));
        }
        public void ASendedBTIsInsertedInRepository()
        {
            var bt = SendABt();

            BusinessTripRepository     businessTripRepo = new BusinessTripRepository();
            IEnumerable <BusinessTrip> storedBts        = businessTripRepo.GetAllBts();

            Assert.IsTrue(storedBts.Any(b => b.ID == bt.ID));
        }
        public void AllSendedBTAreInsertedInRepository()
        {
            for (int i = 0; i < 10; i++)
            {
                SendABt();
            }


            BusinessTripRepository     businessTripRepo = new BusinessTripRepository();
            IEnumerable <BusinessTrip> storedBts        = businessTripRepo.GetAllBts();

            Assert.AreEqual(10, storedBts.Count());
        }
        public void ASendedBTCanBeCanceled()
        {
            var bt = SendABt();

            BusinessTripRepository businessTripRepo = new BusinessTripRepository();
            List <BusinessTrip>    storedBts        = businessTripRepo.GetPendingBTForManager(bt.Manager);
            var storedBt = storedBts.First();

            storedBt.Cancel();

            List <BusinessTrip> approvedBts = businessTripRepo.GetCanceldBTForEmployee(bt.Employee);

            Assert.IsTrue(approvedBts.Any(b => b.ID == bt.ID));
        }
        public void Setup()
        {
            manager = new Manager("Mihail", "*****@*****.**");
            Location location = new Location("BT");

            var office = new Office(manager, location);

            emp = office.CreateEmployee("Valentin", "*****@*****.**");

            startingDate = new DateTime(2008, 04, 14);
            endDate      = new DateTime(2008, 04, 30);

            meaningOfTransportation = "bmw";
            AccommodationIsNeeded   = true;
            BusinessTripRepository businessTripRepo = new BusinessTripRepository();

            businessTripRepo.CleanUp();
            EmailServiceLocator.SetEmailService(new EmailServiceTest());
            BusinessTripFormatterServiceLocator.SetFormatter(new BusinessTripFormatterTest());
        }
        public void Setup()
        {
            manager = new Manager("Mihail", "*****@*****.**");
            Location location = new Location("BT");

            var office = new Office(manager, location);

            emp = office.CreateEmployee("Valentin", "*****@*****.**");

            startingDate            = new DateTime(2008, 04, 14);
            endDate                 = new DateTime(2008, 04, 30);
            phone                   = "112";
            bankCard                = "1502 4023 3453 3252";
            meaningOfTransportation = "bmw";
            AccommodationIsNeeded   = true;
            BusinessTripRepository businessTripRepo = new BusinessTripRepository();

            businessTripRepo.CleanUp();
            EmailServiceLocator.SetEmailService(new GmailEmailService());
            BusinessTripFormatterServiceLocator.SetFormatter(new BusinessTripFormatterTest());
        }