public void LendingModel_ShouldHaveBorrowerNameProperty()
 {
     //---------------Set up test pack-------------------
     var lendingModel = new LendingModel();
     const string Jack = "Jack";
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     lendingModel.BorrowerName = Jack;
     //---------------Test Result -----------------------
     Assert.AreEqual(Jack, lendingModel.BorrowerName);
 }
 public void LendingModel_ShouldHaveAnItemDescriptionProperty()
 {
     //---------------Set up test pack-------------------
     var lendingModel = new LendingModel();
     const string BluePen = "Blue pen";
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     lendingModel.ItemDescription = BluePen;
     //---------------Test Result -----------------------
     Assert.AreEqual(BluePen, lendingModel.ItemDescription);
 }
 public void Index_GivenPostedLendingModel_ShouldDisplaySuccessfullyLended()
 {
     //---------------Set up test pack-------------------
     var loanRepository = Substitute.For<ILoanRepository>();
     var homeController = new HomeController(loanRepository);
     var lendingModel = new LendingModel();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     homeController.Index(lendingModel);
     //---------------Test Result -----------------------
     var message = homeController.ViewBag.Message;
     Assert.AreEqual("Successfully Lended", message);
 }
 public void Index_GivenApostedLendingModel_ShouldRenderDefaultView()
 {
     //---------------Set up test pack-------------------
     var loanRepository = Substitute.For<ILoanRepository>();
     var homeController = new HomeController(loanRepository);
     var lendingModel = new LendingModel();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     homeController.WithCallTo(controller => controller.Index(lendingModel))
         .ShouldRenderDefaultView()
         .WithModel(lendingModel);
     //---------------Test Result -----------------------
 }
 public void Index_GivenPostedLendingLibraryModel_ShouldAddLoanToLoanRepository()
 {
     //---------------Set up test pack-------------------
     var loanRepository = Substitute.For<ILoanRepository>();
     var homeController = new HomeController(loanRepository);
     var lendingModel = new LendingModel();
     lendingModel.BorrowerName = "Kevin";
     lendingModel.ItemDescription = "Pen";
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     homeController.Index(lendingModel);
     //---------------Test Result -----------------------
     loanRepository.Received().AddLoan("Pen", "Kevin");
 }
 public ActionResult Index(LendingModel lendingModel)
 {
     _loanRepository.AddLoan(lendingModel.ItemDescription, lendingModel.BorrowerName);
     ViewBag.Message = "Successfully Lended";
     return View(lendingModel);
 }
 public ActionResult Index()
 {
     var model = new LendingModel();
     return View(model);
 }