public async Task Given_An_Existing_Profile__When_Updating_Multiple_Values__Update_Is_Done_Correctly() { // Arrange var profile = await this.CreateTestProfile(); var mutate = new MutateProfileRequest { Bio = "Updated Bio", DisplayName = "Updated Display name" }; // Act profile.Update(mutate); var updatedProfiel = await this.unitOfWork.Profiles.Update(profile); // Assert Assert.AreEqual(profile.Username, updatedProfiel.Username); Assert.AreEqual(mutate.DisplayName, updatedProfiel.DisplayName); Assert.AreEqual(mutate.Bio, updatedProfiel.Bio); Assert.AreEqual(profile.ImageUrl, updatedProfiel.ImageUrl); }
public void Given_An_Update_Profile_Request__When_Calling_Update__Profile_Data_Is_Correctly_Updated() { // Arrange var profile = CreateProfile(); var mutateRequest = new MutateProfileRequest { DisplayName = "Updated Display Name", Bio = "Updated Bio", ImageUrl = "Updated link" }; // Act profile.Update(mutateRequest); // Assert Assert.AreEqual(profile.Username, profile.Username); Assert.AreEqual(mutateRequest.DisplayName, profile.DisplayName); Assert.AreEqual(mutateRequest.Bio, profile.Bio); Assert.AreEqual(mutateRequest.ImageUrl, profile.ImageUrl); }
public void Update(MutateProfileRequest mutate) { this.Bio = mutate.Bio ?? this.Bio; this.ImageUrl = mutate.ImageUrl ?? this.ImageUrl; this.DisplayName = mutate.DisplayName ?? this.DisplayName; }