Esempio n. 1
0
        /// <summary>
        /// Runs a sequence of actions on an instance of the <see cref="UserStorageService"/> class.
        /// </summary>
        public void Run()
        {
            userRepositoryManager.Start();
            userStorageService.Add(new User
            {
                FirstName = "Alex",
                LastName  = "Black",
                Age       = 25
            });
            userRepositoryManager.Stop();

            userRepositoryManager.Start();
            userStorageService.Remove((u) => u.FirstName == "Bill");
            userRepositoryManager.Stop();

            userRepositoryManager.Start();
            userStorageService.Search((u) => u.FirstName == "Alex");
            userRepositoryManager.Stop();
        }
Esempio n. 2
0
        /// <summary>
        /// Runs a sequence of actions on an instance of the <see cref="UserStorageService"/> class.
        /// </summary>
        public void Run()
        {
            var filePath = ConfigurationManager.AppSettings["FilePath"];

            repositoryManager.Start();

            UserStorageServiceMaster m = new UserStorageServiceMaster((IUserRepository)repositoryManager, new List <UserStorageServiceSlave>(new[] { new UserStorageServiceSlave(new UserRepositoryWithState()), new UserStorageServiceSlave(new UserRepositoryWithState()) }));

            m.AddSubscriber(new UserStorageServiceSlave((IUserRepository)repositoryManager));
            m.Add(new User()
            {
                FirstName = "a",
                LastName  = "b",
                Age       = 55
            });

            repositoryManager.Stop();
            ///_userStorageService.Remove(null);

            ///_userStorageService.Search(null);
        }