예제 #1
0
        public void SalespersonControllerTest_GetAll()
        {
            SalespersonController controller = new SalespersonController();

            var people = controller.Get();

            Assert.AreNotEqual(0, people.ToList().Count);
        }
예제 #2
0
        public void SalespersonControllerTest_Get()
        {
            SalespersonController controller = new SalespersonController();

            var person = controller.Get(1);

            const string name = "Mike";

            Assert.AreEqual(name, person.Name);
        }
예제 #3
0
        public void SalespersonControllerTest_PUT()
        {
            SalespersonController controller = new SalespersonController();

            var person = controller.Get(3);

            string nameOld = person.Name;
            string nameNew = "Watson";

            person.Name = nameNew;

            controller.Put(person.Id, person);
            person = null;

            person = controller.Get(3);

            Assert.AreEqual(nameNew, person.Name);

            person.Name = nameOld;
            controller.Put(person.Id, person);
        }
예제 #4
0
        public void SalespersonControllerTest_POST_DELETE()
        {
            SalespersonController controller = new SalespersonController();

            var person = new Salesperson()
            {
                Id       = 0,
                Name     = "Controller",
                LastName = "Test"
            };

            controller.Post(person);

            person = controller.Get().ToList().SingleOrDefault(x => { return(x.Name.Equals(person.Name) && x.LastName.Equals(person.LastName)); });

            controller.Delete(person.Id);
        }