public void ThrowArgumentNullException_WhenNullValueIsPassed() { var contextOptions = new DbContextOptionsBuilder <DealershipContext>() .UseInMemoryDatabase(databaseName: "EditModelCorrectly_WhenValidParametersArePassed").Options; string[] invalidParameters = null; IEditCarService sut; using (var dealershipContext = new DealershipContext(contextOptions)) { var carServiceStub = new Mock <ICarService>(); sut = new Dealership.Services.EditCarService(dealershipContext, carServiceStub.Object); } Assert.ThrowsException <ArgumentNullException>(() => sut.EditHorsePower(invalidParameters)); }