public void Should_returnValidationException_Address() { var(_, exception) = new ModifyUserAddress(UserFakeMother.BuildUserWithAddress()).UpdateUserAddress(null); Assert.NotNull(exception); Assert.IsTrue(exception is ValidationException); Assert.AreEqual(new ValidationException("address").Message, exception.Message); }
public User GetById(int userId) { if (userId == default) { return(null); } return(UserFakeMother.BuildUserWithAddress(userId)); }
public void Should_returnUser_with_address_modified() { var originalUser = UserFakeMother.BuildUserWithAddress(); var newAddress = AddressFakeMother.OkAddress(); var(updatedUser, exception) = new ModifyUserAddress(originalUser).UpdateUserAddress(newAddress); Assert.NotNull(updatedUser); Assert.Null(exception); Assert.AreEqual(updatedUser.PrimaryAddress, newAddress); }