private void describe_StartRegistrationAsync() { before = () => _sut.StartRegistrationAsync(UserRegistrationFormMother.JohnDow()).Wait(); it["saves UserRegistrationStarted event"] = () => _eventStore.LastSavedEvents.Single().should_cast_to <UserRegistrationStarted>(); }
private void describe_application() { context["when two user registration processes have been started for users with same emails"] = () => { var userId1 = new Guid(); var userId2 = new Guid(); before = () => { var userRegistrationForm = UserRegistrationFormMother.JohnDow(); userId1 = _commandService .StartRegistrationAsync(userRegistrationForm) .Result; userId2 = _commandService .StartRegistrationAsync(userRegistrationForm) .Result; }; it["eventually returns succeeded result for one user and failed result for another user"] = () => { Eventually.IsTrue(() => { var queryResults = new[] { _queryService.GetAsync(userId1).Result, _queryService.GetAsync(userId2).Result }; return (queryResults.Contains(Option.Some(UserRegstrationProcessQueryResult.Succeeded)) && queryResults.Contains(Option.Some(UserRegstrationProcessQueryResult.Failed))); }); }; }; }