public void ShouldBeAbleToThrowArgumentExeptionWhenUpdatingUser() { InMemoryStorage storage = new InMemoryStorage(); UserModel illegalUser = new UserModel { Id = -1, FirstName = "1", LastName = "1", Birthdate = DateTime.Now }; Assert.Throws <ArgumentException>(() => storage.UpdateUser(illegalUser)); }
public void ShouldBeAbleToUpdateUsersFirstName() { InMemoryStorage storage = new InMemoryStorage(); int testedUserdId = 5; string testedFirstName = "test"; UserModel testUser = new UserModel { Id = testedUserdId, FirstName = testedFirstName, LastName = "", Birthdate = DateTime.Now }; var result = storage.UpdateUser(testUser); var changedUser = storage.GetUsersList().FirstOrDefault(x => x.Id == testedUserdId); Assert.True(result); Assert.NotNull(changedUser); Assert.Equal(changedUser.FirstName, testedFirstName); }
public void ShouldBeAbleToThrowArgumentNullExeptionWhenUpdatingUser() { InMemoryStorage storage = new InMemoryStorage(); Assert.Throws <ArgumentNullException>(() => storage.UpdateUser(null)); }