Ejemplo n.º 1
0
        public void Index()
        {
            var controller = new VehiclesController();

            var result = controller.Index();

            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public void vehicleObjTypeTest()
        {
            var customerRepository = new CustomersRepositor();
            var controller         = new VehiclesController(customerRepository);

            var result = controller.Index();

            Assert.IsType <Microsoft.AspNetCore.Mvc.ViewResult>(result);
        }
Ejemplo n.º 3
0
        public void VerifyVehicleCustomers()
        {
            var customerRepository = new Mock <IVehiclesRepository>();

            customerRepository.Setup(m => m.CustomersList()).Returns(new List <Customers>
            {
                new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(),
                new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(),
                new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(), new Customers(),
            });
            //Check if the constructor is passed the obj
            var controller = new VehiclesController(customerRepository.Object);
            var result     = Assert.IsType <Microsoft.AspNetCore.Mvc.ViewResult>(controller.Index());
            var model      = Assert.IsType <List <Customers> >(result.Model);

            Assert.Equal(21, model.Count);
        }
Ejemplo n.º 4
0
        public void TestVehiclesList()
        {
            Mock <IVtsWebService> service = new Mock <IVtsWebService>();

            service.Setup(s => s.GetVehiclesForUser(It.IsAny <string>(), It.IsAny <string>())).Returns(new VehicleDto[]
            {
                new VehicleDto()
                {
                    Id             = 30,
                    Manufacturer   = 1,
                    Mileage        = 23000,
                    Model          = "307",
                    ProductionYear = 2007,
                    RegisteredDate = DateTime.Now,
                    Vin            = "1234567891234567;"
                },
                new VehicleDto()
                {
                    Id             = 30,
                    Manufacturer   = 2,
                    Mileage        = 24000,
                    Model          = "307",
                    ProductionYear = 2007,
                    RegisteredDate = DateTime.Now,
                    Vin            = "1234567891454567;"
                },
            });
            VehiclesController controller = new VehiclesController(service.Object);
            ViewResult         res        = controller.Index(new User()
            {
                Login = "******", PasswordHash = "1234dfsfsd"
            });

            Assert.IsNotNull(res);
            List <Vehicle> model = res.Model as List <Vehicle>;

            Assert.IsNotNull(model);
            Assert.AreEqual(model.Count, 2);
        }
Ejemplo n.º 5
0
        public void VehileListAccounts()
        {
            var customerRepository = new CustomersRepositor();
            var controller         = new VehiclesController(customerRepository);
            var result             = Assert.IsType <Microsoft.AspNetCore.Mvc.ViewResult>(controller.Index());
            var model = Assert.IsType <List <Customers> >(result.Model);

            Assert.Equal(21, model.Count);
        }