public void Should_returnValidationException_DoorTooLong()
        {
            var newAddress = AddressFakeMother.DoorTooLong();

            var(_, exception) = new ModifyUserAddress(UserFakeMother.BuildUserWithAddress()).UpdateUserAddress(newAddress);
            Assert.NotNull(exception);
            Assert.IsTrue(exception is ValidationException);
            Assert.AreEqual(new ValidationException("address").Message, exception.Message);
        }
        public void ShouldReturnOk()
        {
            const int userId     = 1;
            var       newAddress = AddressFakeMother.OkAddress();

            var(ok, exception) = new UpdateUserAddressFacade(_getUserRepository, _updateRepository).Exec(userId, newAddress);
            Assert.IsTrue(ok);
            Assert.Null(exception);
        }
        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);
        }
        public void ShouldReturnFail_with_exception()
        {
            const int userId     = default;
            var       newAddress = AddressFakeMother.OkAddress();

            var(ok, exception) = new UpdateUserAddressFacade(_getUserRepository, _updateRepository).Exec(userId, newAddress);
            Assert.IsFalse(ok);
            Assert.NotNull(exception);
            Assert.IsTrue(exception is NotFoundException);
            Assert.AreEqual(new NotFoundException("User").Message, exception.Message);
        }