Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }