public void ValidateModelAttribute_WithError_ShouldThrowsException() { //Arrange var db = new ExpenseTrackerDbContext( new DbContextOptionsBuilder().UseInMemoryDatabase("test").Options); var service = new ExpensesService(db); //Act var result = service.AddAsync(AMOUNT, DESCRITION, CATEGORY_ID, USER_ID).Result; //Assert Assert.IsNotNull(result); Assert.IsTrue(result.Id != 0); }