Ejemplo n.º 1
0
        public async Task CarSearchHasProperTextSet()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new CarSearchController(_dbContext);
            var result            = await carMakesControler.Index() as ViewResult;

            Assert.AreEqual(result.ViewData["faultsText"], "Cars with issue");
        }
Ejemplo n.º 2
0
        public async Task FaultCantBeDisconnectedIfIDVersionNotFound()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new CarFaultsController(_dbContext);
            var result            = await carMakesControler.RemoveConnection(2, 32343) as ActionResult;

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Ejemplo n.º 3
0
        public async Task FaultSearchReturnsNotFoundIfVersionIs0()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new FaultSearchController(_dbContext);
            var result            = await carMakesControler.GetVersionFaults("0") as ActionResult;

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Ejemplo n.º 4
0
        public async Task VersionCantBeEditedWithoutVersionExisting()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new CarVersionsController(_dbContext);
            var result            = await carMakesControler.Edit(-1) as ActionResult;

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Ejemplo n.º 5
0
        public async Task CarMakesDetailDoesntAcceptNull()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new CarMakesController(_dbContext);
            var result            = await carMakesControler.Details(null) as ActionResult;


            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Ejemplo n.º 6
0
        public async Task CarMakesRedirectsToCarEdit()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new CarMakesController(_dbContext);
            var result            = await carMakesControler.Index() as RedirectToActionResult;


            Assert.AreEqual(result.ControllerName, "CarEdit");
            Assert.AreEqual(result.ActionName, "Index");
        }
Ejemplo n.º 7
0
        public async Task FaultSearchReturnsEmptyJsonIfVersionDoesntExist()
        {
            var options = new DbContextOptionsBuilder <FaultsContext>();

#pragma warning disable CS0618 // Type or member is obsolete
            options.UseInMemoryDatabase();
#pragma warning restore CS0618 // Type or member is obsolete
            var _dbContext = new FaultsContext(options.Options);

            var carMakesControler = new FaultSearchController(_dbContext);
            var result            = await carMakesControler.GetVersionFaults("500") as JsonResult;

            string json = JsonConvert.SerializeObject(result.Value);
            Console.Write(json);


            Assert.AreEqual(json, "[]");
        }
 public CarVersionsController(FaultsContext context)
 {
     _context = context;
 }
Ejemplo n.º 9
0
 public CarSearchController(FaultsContext context)
 {
     _context = context;
 }
 public CarModelsController(FaultsContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public CarEditController(FaultsContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public CarMakesController(FaultsContext context)
 {
     _context = context;
 }