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

            try {
                registeredCustomer.ConfirmEmailAddress(command);
            } catch (WrongConfirmationHashException e) {
                throw new XunitException("unexpected error in givenEmailAddressWasConfirmed: " + e.Message);
            }
        }
示例#2
0
        private void WHEN_ConfirmEmailAddress_With(Hash confirmationHash)
        {
            var command = ConfirmCustomerEmailAddress.Build(customerID.Value, confirmationHash.Value);

            try {
                recordedEvents = registeredCustomer.ConfirmEmailAddress(command);
            } catch (NullReferenceException e) {
                throw new XunitException(THelper.propertyIsNull("confirmationHash"));
            }
        }
示例#3
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));
        }
示例#4
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);
        }
示例#5
0
        void confirmEmailAddress_withWrongConfirmationHash()
        {
            // Given
            givenARegisteredCustomer();

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

            Assert.Throws <WrongConfirmationHashException>(() => registeredCustomer.ConfirmEmailAddress(command));

            // and the emailAddress should not be confirmed
            Assert.False(registeredCustomer.IsEmailAddressConfirmed);
        }
示例#6
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);
        }
示例#7
0
        void confirmEmailAddress_whenItWasPreviouslyConfirmedAndThenChanged()
        {
            // Given
            givenARegisteredCustomer();
            givenEmailAddressWasConfirmed();
            givenEmailAddressWasChanged();

            // When confirmCustomerEmailAddress
            // Then it should succeed
            var command = ConfirmCustomerEmailAddress.Build(customerID.Value, changedConfirmationHash.Value);

            registeredCustomer.ConfirmEmailAddress(command);

            // and the emailAddress should be confirmed
            Assert.True(registeredCustomer.IsEmailAddressConfirmed);
        }