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