public void ManageCarModel_CarObj_IsNull() { //Arrange var sut = new CarModelRepository(_mockContext.Object); //Act var returnedValue = sut.ManageCarModel(null); //Assert Assert.Equal(0, returnedValue); }
public void ManageCarModel_CarObj_IsNotNull_Edit_ShouldCallCorrectMethods() { //Arrange var sut = new CarModelRepository(_mockContext.Object); //Act _ = sut.ManageCarModel(new CarModel() { ModelName = "m2" }); //Assert _mockContext.Verify(x => x.CarModels.Add(It.IsAny <CarModel>()), Times.Never); _mockContext.Verify(x => x.SaveChanges(), Times.Once); }