public static void ShouldYieldAccepted( [Frozen] SpAuthApi api, FreshOrganizationFixture organization ) { var customerInviteHref = organization.InviteStatusLink; var customerInvite = new SpAuthApi.CustomerInvite { EmailTo = "*****@*****.**", RequestId = Guid.NewGuid() }; var apiResult = api.InviteCustomer( customerInviteHref, customerInvite ); Assert.Equal( HttpStatusCode.Accepted, apiResult.StatusCode ); }
public static void ShouldTurnInviteStatusOpenAndUpdateLastInviteTo( [Frozen] SpAuthApi api, FreshOrganizationFixture organization ) { var customerInviteHref = organization.InviteStatusLink; // TOCONSIDER: Extract fixture to represent anonymous email address const string emailToTemplate = "*****@*****.**"; char charToChangeCaseOf = emailToTemplate.ToCharArray().Where( Char.IsLower ).ToArray().ElementAtRandom(); string emailToMutated = emailToTemplate.Replace( charToChangeCaseOf, Char.ToUpper( charToChangeCaseOf ) ); var customerInvite = new SpAuthApi.CustomerInvite { EmailTo = emailToMutated, RequestId = Guid.NewGuid() }; var inviteResult = api.InviteCustomer( customerInviteHref, customerInvite ); Assert.Equal( HttpStatusCode.Accepted, inviteResult.StatusCode ); Verify.EventuallyWithBackOff( () => { var statusResult = api.GetInviteStatus( customerInviteHref ); Assert.Equal( HttpStatusCode.OK, statusResult.StatusCode ); var result = statusResult.Data; Assert.Equal( "OpenInvitation", result.State ); Assert.Equal( emailToMutated, result.LastEmailSentTo ); } ); }