public void GetAllAutomobiles_ShouldCallRepositoryGetAutomobiles() { var controller = new GasAutomobileController(_mockRepo.Object); controller.GetAllAutomobiles(); _mockRepo.Verify(m => m.GetAutomobiles()); }
public void GetAllAutomobiles_ShouldReturnEmptyList_GivenNoAutosReturnedFromRepo() { var controller = new GasAutomobileController(_mockRepo.Object); _mockRepo.Setup(m => m.GetAutomobiles()).Returns((List <GasAutomobile>)null); var result = controller.GetAllAutomobiles(); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); }
public void GetAllAutomobiles_ShouldReturnTask_GivenAutosReturnedFromRepo() { var vin = "1"; var auto = new GasAutomobile() { VIN = vin }; var tasks = new List <GasAutomobile>(); tasks.Add(auto); var controller = new GasAutomobileController(_mockRepo.Object); _mockRepo.Setup(m => m.GetAutomobiles()).Returns(tasks); var result = controller.GetAllAutomobiles(); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count()); Assert.AreEqual(auto, result.First()); }