Ejemplo n.º 1
0
        public void GetUserLogs_ShouldGetFullListOfUserLogs()
        {
            _userLogsRepository.GetUserLogs().Returns(new List <UserLog>
            {
                new UserLog
                {
                    Id         = 1,
                    SearchTime = 100,
                    Phrase     = new Phrase {
                        Id = 1, Text = "Angela Merkel"
                    },
                    Anagram = new Anagram {
                        Id = 1, Text = "Karamelengel"
                    },
                    User = new User {
                        Id = 1, Ip = "::1", SearchesLeft = 5
                    }
                },
                new UserLog
                {
                    Id         = 2,
                    SearchTime = 100,
                    Phrase     = new Phrase {
                        Id = 1, Text = "Angela Merkel"
                    },
                    Anagram = new Anagram {
                        Id = 1, Text = "klare Maengel"
                    },
                    User = new User {
                        Id = 1, Ip = "::1", SearchesLeft = 5
                    }
                },
                new UserLog
                {
                    Id         = 3,
                    SearchTime = 100,
                    Phrase     = new Phrase {
                        Id = 1, Text = "Angela Merkel"
                    },
                    Anagram = new Anagram {
                        Id = 1, Text = "gare kamellen"
                    },
                    User = new User {
                        Id = 1, Ip = "::1", SearchesLeft = 5
                    }
                }
            });

            var userLogsResult = _userLogsService.GetUserLogs();

            _userLogsRepository.Received().GetUserLogs();
            userLogsResult.ShouldNotBeNull();
            userLogsResult.ShouldNotBeEmpty();
            userLogsResult.First().ShouldBeOfType(typeof(UserLog));
            userLogsResult.First().Anagram.Text.ShouldBe("Karamelengel");
        }
Ejemplo n.º 2
0
        public IList <UserLog> GetUserLogs()
        {
            var userLogs = _userLogsRepository.GetUserLogs();

            return(userLogs);
        }