Пример #1
0
        public void Initialize()
        {
            // Initialize fake users
            fakeUserAlice = new User
            {
                Name = "Alice",
                Timeline = new List<Story>
                {
                    new Story { Message = "I love the weather today", PostedOn = DateTime.Now }
                }
            };
            fakeUserBob = new User
            {
                Name = "Bob",
                Timeline = new List<Story>
                {
                    new Story { Message = "Damn! We lost!", PostedOn = DateTime.Now.AddMinutes(-5) },
                    new Story { Message = "Good game though.", PostedOn = DateTime.Now }
                }
            };

            // Initializes a fake repository that returns the fake users
            userRepository = new Contracts.Interfaces.Fakes.StubIRepository<User>
            {
                GetOrCreateString = (userName) => userName == "Alice" ? fakeUserAlice : fakeUserBob,
            };

            sut = new TimelineReaderService(userRepository);
        }
Пример #2
0
        public void Initialize()
        {
            // Initialize fake user
            fakeUser = new User
            {
                Name = "Alice",
                Timeline = new List<Story>()
            };

            // Initializes a fake repository that returns the fake user
            // and attaches an observer to it in order to check if the repository
            // is correctly called by the TimelineWriterService
            userRepositoryObserver = new StubObserver();
            userRepository = new Contracts.Interfaces.Fakes.StubIRepository<User>
            {
                GetOrCreateString = (userName) => fakeUser,
                InstanceObserver = userRepositoryObserver
            };

            sut = new TimelineWriterService(userRepository);
        }
Пример #3
0
        public void Initialize()
        {
            // Initialize fake users
            fakeUserCharlie = new User
            {
                Name = "Charlie",
                Timeline = new List<Story>(),
                Following = new List<User>()
            };
            fakeUserAlice = new User
            {
                Name = "Alice",
                Timeline = new List<Story>()
            };

            // Initializes a fake repository that returns the fake users
            userRepository = new Contracts.Interfaces.Fakes.StubIRepository<User>
            {
                GetOrCreateString = (userName) => userName == "Charlie" ? fakeUserCharlie : fakeUserAlice
            };

            sut = new FollowerService(userRepository);
        }
Пример #4
0
 /// <summary>
 /// Gets a list of the followed users AND the follower user
 /// </summary>
 /// <param name="followerUser"></param>
 /// <returns></returns>
 private IEnumerable<User> GetUsersToMergeStoriesFrom(User followerUser)
 {
     var result = followerUser.Following.ToList();
     result.Add(followerUser);
     return result;
 }