Beispiel #1
0
        public void Show_HasCorrectModelType_Stylist()
        {
            StylistController controller = new StylistController();
            ViewResult        showView   = controller.Show(Stylist.CreateStylist("mike", "beard")) as ViewResult;
            var result = showView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Stylist));
        }
Beispiel #2
0
        public void Show_ReturnsCorrectView_True()
        {
            StylistController controller = new StylistController();
            int           id             = Stylist.CreateStylist("mike", "beard");
            IActionResult showView       = controller.Show(id);

            Assert.IsInstanceOfType(showView, typeof(ViewResult));
        }
Beispiel #3
0
        public void Show_ReturnsCorrectView_True()
        {
            ClientController controller = new ClientController();
            int           newStylistId  = Stylist.CreateStylist("firstName", "lastName");
            int           id            = Client.CreateClient(newStylistId, "mike", "beard");
            IActionResult showView      = controller.Show(id);

            Assert.IsInstanceOfType(showView, typeof(ViewResult));
        }
        public void DeleteStylist_RemoveStylistFromDataBase_True()
        {
            int            newStylistId = Stylist.CreateStylist("mike", "beard");
            List <Stylist> expected     = new List <Stylist> {
            };

            Stylist.GetStylist(newStylistId).DeleteStylist();
            List <Stylist> result = Stylist.GetAll();

            CollectionAssert.AreEqual(expected, result);
        }
Beispiel #5
0
        public void Show_HasCorrectViewBagType_Client()
        {
            ClientController controller = new ClientController();
            int        newStylistId     = Stylist.CreateStylist("no", "name");
            int        newClientId      = Client.CreateClient(newStylistId, "mike", "beard");
            Client     newClient        = Client.GetClient(newClientId);
            ViewResult showView         = controller.Show(newClientId) as ViewResult;
            var        result           = showView.ViewData["Stylist"];

            Assert.IsInstanceOfType(result, typeof(Stylist));
        }
        public void EditName_ChangeStylistsName_Void()
        {
            int    newStylistId = Stylist.CreateStylist("mike", "beard");
            string newFirstName = "pam";
            string newLastName  = "whiskers";

            Stylist.GetStylist(newStylistId).EditName(newFirstName, newLastName);
            string expected = newFirstName + newLastName;
            string result   = Stylist.GetStylist(newStylistId).FirstName + Stylist.GetStylist(newStylistId).LastName;

            Assert.AreEqual(expected, result);
        }
        public void CreateStylist_SavesStylistToDatabase_Stylist()
        {
            string         firstName   = "mike";
            string         lastName    = "beard";
            Stylist        testStylist = new Stylist();
            int            stylistId   = Stylist.CreateStylist(firstName, lastName);
            List <Stylist> result      = Stylist.GetAll();
            List <Stylist> testList    = new List <Stylist> {
                Stylist.GetStylist(stylistId)
            };

            CollectionAssert.AreEqual(testList, result);
        }
Beispiel #8
0
        public IActionResult Create(string firstName, string lastName)
        {
            int id = Stylist.CreateStylist(firstName, lastName);

            return(RedirectToAction("Show", new { id = id }));
        }