public void CreatingANewReport_AddsItToTheDb() { var controller = new DailyReportsController(this.session); string customerName = "Pippo1"; this.session.Save(new Customer { Name = customerName, VATNumber = "12345678901" }); var reportDate = new DateTime(2012, 11, 29, 8, 0, 0); var viewModel = new DailyReportViewModel { CustomerId = 1, Date = reportDate, MorningStart = "09:00", MorningEnd = "13:00", AfternoonStart = "14:00", AfternoonEnd = "18:00", Offsite = true, Notes = "La macchinetta del caffé fa pena." }; var result = controller.Create(viewModel); var redirectResult = result as RedirectToRouteResult; var action = redirectResult.RouteValues["action"]; var reportOnDb = this.session.Get <DailyReport>(1); reportOnDb.Should().Not.Be.Null(); reportOnDb.Customer.Should().Not.Be.Null(); reportOnDb.Customer.Name.Should().Be.EqualTo(customerName); reportOnDb.Date.Should().Be.EqualTo(reportDate); }
public ActionResult Delete(FormCollection _form) { DailyReportsController drc = new DailyReportsController(Server); return((ActionResult)drc.Delete(Request)["view"]); //return null; }
public ActionResult Index(tbldailyreport c) { DailyReportsController drc = new DailyReportsController(Server); return((ActionResult)drc.IndexPost(Request, c)["view"]); //return null; }
public void EnteringTheSite_IShouldSeeAnEmptyList() { var controller = new DailyReportsController(this.session); var result = controller.Index(); var viewResult = result as ViewResult; var model = viewResult.Model as IEnumerable <DailyReportListItemViewModel>; model.Should().Not.Be.Null(); model.Should().Have.Count.EqualTo(0); }
public void AccessingTheReportsManagment_ShowsTheListOfReports() { var controller = new DailyReportsController(this.session); Mapper.CreateMap <DailyReport, DailyReportListItemViewModel>(); var result = controller.Index(); var viewResult = (ViewResult)result; var model = viewResult.Model as IEnumerable <DailyReportListItemViewModel>; model.Should().Not.Be.Null(); }
public void AddingANewActvity_PutsItInTheDb() { var controller = new DailyReportsController(this.session); string customerName = "Pippo1"; var customer = new Customer { Name = customerName, VATNumber = "12345678901" }; this.session.Save(customer); var dailyReport = new DailyReport { Customer = customer, MorningStart = "09:00", MorningEnd = "13:00", AfternoonStart = "14:00", AfternoonEnd = "18:00", Date = new DateTime(2012, 12, 11) }; this.session.Save(dailyReport); var result = controller.ManageReport(1, new ActivityViewModel { Description = "Corso Asp.Net Mvc", Hours = 4m }); this.session.Flush(); var redirectResult = result as RedirectToRouteResult; var action = redirectResult.RouteValues["action"]; action.Should().Be.EqualTo("ManageReport"); var activityOnDb = this.session.Get <Activity>(1); activityOnDb.Should().Not.Be.Null(); }
public void TheCreateReportView_ShowsAComboOfCustomers() { var controller = new DailyReportsController(this.session); this.session.Save(new Customer { Name = "Pippo1", VATNumber = "12345678901" }); this.session.Save(new Customer { Name = "Pippo2", VATNumber = "12345678902" }); this.session.Save(new Customer { Name = "Pippo3", VATNumber = "12345678903" }); var result = controller.Create(); var viewResult = (ViewResult)result; var selectCustomerList = viewResult.ViewBag.SelectCustomerList as SelectList; selectCustomerList.Should().Not.Be.Null(); selectCustomerList.Count().Should().Be.EqualTo(3); }
// GET: CRM/Schs // GET: CRM/Mis1 public ActionResult Index() { DailyReportsController drc = new DailyReportsController(Server); return((ActionResult)drc.Index(Request)["view"]); }