public async Task ListModel() { //Arrange var BDName = Guid.NewGuid().ToString(); var context = BuildContext(BDName); var fakemodel = new Modelo() { Nombre = "Subaru Legacy", }; var fakemodel2 = new Modelo() { Nombre = "SsangYong Tivoli", }; context.Modelos.Add(fakemodel); context.Modelos.Add(fakemodel2); await context.SaveChangesAsync(); var context2 = BuildContext(BDName); //Act var controller = new ModeloesController(context2); var response = await controller.List(); //Assert Assert.IsNotNull(response); }
public void Lista_modelos() { var controller = new ModeloesController(); var result = controller.Index() as ViewResult; Assert.AreNotEqual(null, result.Model); }
public void Detalhes_modelo() { var controller = new ModeloesController(); var result = controller.Details(1) as ViewResult; Assert.AreNotEqual(null, result.Model); }
public void Salva_novo_modelo() { Modelo _modelo = new Modelo(); _modelo.Descricao = "ModeloTeste"; var controller = new ModeloesController(); var result = controller.Create(_modelo) as ViewResult; var ModeloValido = controller.ModelState.IsValid; Assert.IsTrue(ModeloValido); }
public async Task AddaModel() { //Arrange var BDName = Guid.NewGuid().ToString(); var context = BuildContext(BDName); //Act var newmodel = new CreateModeloViewModel() { Nombre = "Subaru Legacy", }; var controller = new ModeloesController(context); var response = await controller.Create(newmodel); //Assert Assert.IsNotNull(response); }