示例#1
0
        private void givenEmailAddressWasConfirmed()
        {
            var command = ConfirmCustomerEmailAddress.Build(customerID.Value, confirmationHash.Value);

            try {
                registeredCustomer = Customer2.ConfirmEmailAddress(registeredCustomer, command);
            } catch (WrongConfirmationHashException e) {
                throw new XunitException("unexpected error in givenEmailAddressWasConfirmed: " + e.Message);
            }
        }
示例#2
0
        void confirmEmailAddress_withWrongConfirmationHash()
        {
            // Given
            givenARegisteredCustomer();

            // When confirmCustomerEmailAddress
            // Then it should throw WrongConfirmationHashException
            var command = ConfirmCustomerEmailAddress.Build(customerID.Value, wrongConfirmationHash.Value);

            Assert.Throws <WrongConfirmationHashException>(() => Customer2.ConfirmEmailAddress(registeredCustomer, command));
        }
示例#3
0
        void confirmEmailAddress()
        {
            // Given
            givenARegisteredCustomer();

            // When confirmCustomerEmailAddress
            // Then it should succeed
            var command         = ConfirmCustomerEmailAddress.Build(customerID.Value, confirmationHash.Value);
            var changedCustomer = Customer2.ConfirmEmailAddress(registeredCustomer, command);

            // and the emailAddress of the changed Customer should be confirmed
            Assert.True(changedCustomer.IsEmailAddressConfirmed);
        }
示例#4
0
        void confirmEmailAddress_whenItWasPreviouslyConfirmedAndThenChanged()
        {
            // Given
            givenARegisteredCustomer();
            givenEmailAddressWasConfirmed();
            givenEmailAddressWasChanged();

            // When confirmEmailAddress
            // Then it should throw WrongConfirmationHashException
            var command         = ConfirmCustomerEmailAddress.Build(customerID.Value, changedConfirmationHash.Value);
            var changedCustomer = Customer2.ConfirmEmailAddress(registeredCustomer, command);

            // and the emailAddress of the changed Customer should be confirmed
            Assert.True(changedCustomer.IsEmailAddressConfirmed);
        }