Exemplo n.º 1
0
        public async Task Given_A_Non_Existing_UserId__When_Calling_Update_Profile_Usecase__Throws_Profile_Not_Found_Exception()
        {
            // Arrange
            var request = new UpdateProfile(this.userId, "Bio", "Image", "DisplayName");
            var handler = new UpdateProfileHandler(this.unitOfWork);

            // Act + Assert
            Assert.That(async() => await handler.Handle(request, CancellationToken.None), Throws.InstanceOf <ProfileNotFoundException>());
        }
Exemplo n.º 2
0
        public async Task Given_An_Existing_Profile__When_Calling_UpdateProfile_Usecase__Returns_Updated_Profile()
        {
            // Arrange
            var profile = await this.CreateTestProfile();

            var request = new UpdateProfile(this.userId, "Bio", "Image", "DisplayName");
            var handler = new UpdateProfileHandler(this.unitOfWork);

            // Act
            var updatedProfile = await handler.Handle(request, CancellationToken.None);

            // Assert
            Assert.AreEqual(profile.Username, updatedProfile.Username);
            Assert.AreEqual(request.Bio, updatedProfile.Bio);
            Assert.AreEqual(request.ImageUrl, updatedProfile.ImageUrl);
            Assert.AreEqual(request.DisplayName, updatedProfile.DisplayName);
        }