public NewUserScenario(IEventStoreClient eventStoreClient)
 {
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), Substitute.For<IAccountFactory>(), Substitute.For<IAccountContactRefresher>());
     _userRepository.Run().Wait();
     
     _account = new StubAccount();
     _account.CurrentSession.AuthorizedResources.Add("email");
     _account.CurrentSession.AuthorizedResources.Add("calendar");
 }
            public UserWithSingleAccountAddsAccount(IEventStoreClient eventStoreClient)
            {
                var accountFactory = new AccountFactory();
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, Substitute.For<IAccountContactRefresher>());

                _initialAccount = new StubAccount();
                _allAccounts.Add(_initialAccount);

                _newAccount = new StubAccount
                {
                    AccountId = "OtherAccount",
                    DisplayName = "Other Account"
                };
                _allAccounts.Add(_newAccount);
            }
 public FetchUserContactProfileScenario(IEventStoreClient eventStoreClient)
 {
     _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
     var accountFactory = new AccountFactory();
     var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
     _account = CreateAccount();
     _expectedFeed = CreateStubFeed(_account);
     _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, _account, _expectedFeed);
     _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
 }
            public UserWithSingleAccountLogsInScenario(IEventStoreClient eventStoreClient)
            {
                var accountFactory = new AccountFactory();
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, Substitute.For<IAccountContactRefresher>());

                _account = new StubAccount();
                _allAccounts.Add(_account);
            }
            public UserAddsAccountAndContactsSynchronizeScenario(IEventStoreClient eventStoreClient)
            {
                _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
                var accountFactory = new AccountFactory();
                var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
                _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
                _initialAccount = CreateAccount("main");
                _initialAccountContactFeed = new[] { Alex(_initialAccount), Billy(_initialAccount), Charlie(_initialAccount) }.ToObservable();

                _newAccount = CreateAccount("other", "OtherProvider");
                _newAccountContactFeed = new[] { Alex(_newAccount), Derek(_newAccount) }.ToObservable();

                var accContactProviders = new[]
                {
                    CreateAccountContactProvider(_initialAccount, _initialAccountContactFeed),
                    CreateAccountContactProvider(_newAccount, _newAccountContactFeed),
                };

                _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, accContactProviders);
                _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
            }
 public UserRegistrationAccountContactSynchronizationScenario(IEventStoreClient eventStoreClient)
 {
     _contactFeedRepository = new EventStoreContactFeedRepository(eventStoreClient, new ConsoleLoggerFactory());
     var accountFactory = new AccountFactory();
     var accountContactRefresher = new AccountContactRefresher(eventStoreClient);
     _userRepository = new UserRepository(eventStoreClient, new ConsoleLoggerFactory(), accountFactory, accountContactRefresher);
     _account = CreateAccount("*****@*****.**");
     _expectedFeed = new[] { Alex(_account), Billy(_account), Charlie(_account) }.ToObservable();
     var accContactProviders = new[] { CreateAccountContactProvider(_account, _expectedFeed) };
     _accountContactSynchronizationService = CreateAccountContactSynchronizationService(eventStoreClient, accContactProviders);
     _userContactSynchronizationService = new UserContactSynchronizationService(eventStoreClient, new ConsoleLoggerFactory());
 }