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); } }
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)); }
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); }
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); }