Пример #1
0
        public async Task BycicleDeleteAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();

            // Act
            ActionResult result = await controller.DeleteConfirmed(999);

            // Assert
            Assert.IsNotNull(result);
        }
Пример #2
0
        public void bycicleListAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();

            // Act
            IQueryable <Bycicle> result = controller.GetBycicles();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreNotEqual(0, result.ToList().Count);
            Assert.IsInstanceOf <Bycicle>(result.ToList()[0]);
        }
Пример #3
0
        public async Task GetBycicleAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();

            // Act
            IHttpActionResult result = await controller.GetBycicle(1);

            var route = result as OkNegotiatedContentResult <Bycicle>;

            // Assert
            Assert.IsNotNull(route);
            Assert.AreEqual(1, route.Content.BycicleId);
        }
Пример #4
0
        public async Task BycicleDetailsAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();

            // Act
            ActionResult result = await controller.Details(1);

            var viewResult = (ViewResult)result;
            var objlist    = (Bycicle)viewResult.Model;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, objlist.BycicleId);
        }
Пример #5
0
        public async Task BycicleListAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();

            // Act
            ActionResult result = await controller.Index();

            var viewResult = (ViewResult)result;
            var objlist    = (List <Bycicle>)viewResult.Model;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, objlist.Count);
        }
Пример #6
0
        public async Task BycicleEditAsync()
        {
            // Arrange
            ByciclesController controller = new ByciclesController();
            BycicleView        item       = new BycicleView()
            {
                BycicleId   = 999,
                Street      = "Title 1",
                University  = "univerity 1",
                Description = "description 1",
                Latitude    = "232",
                Longitude   = "223",
                IsAvailable = false
            };

            // Act
            ActionResult result = await controller.Edit(item);

            // Assert
            Assert.IsNotNull(result);
        }