private void describe_Start() { context["when event has been added to EventStore"] = () => { before = () => { var someEvent = new DummyEvent(); var eventData = _serializer.ToEventData(someEvent); _connection.AppendToStreamAsync("dummy", ExpectedVersion.Any, eventData).Wait(); _subscription = _sut.Start(_connection); }; after = () => _subscription?.Stop(); it["eventually calls event handler"] = () => Eventually.IsTrue(() => _eventHandler.WasCalledWithDummyEvent); }; }
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))); }); }; }; }