Exemplo n.º 1
0
        public IEnumerable <KudosBasicDataViewModel> GetKudosStats(int months, int amount)
        {
            if (months <= 0 || amount <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            var kudosStatsDto = _kudosService.GetKudosStats(months, amount, GetUserAndOrganization().OrganizationId);
            var result        = _mapper.Map <IEnumerable <KudosBasicDataDTO>, IEnumerable <KudosBasicDataViewModel> >(kudosStatsDto);

            return(result);
        }
Exemplo n.º 2
0
        public void Should_Return_Correctly_Summed_Kudos()
        {
            MockKudosLogsForStats();
            var actual = _kudosService.GetKudosStats(3, 10, 2).ToList();

            Assert.AreEqual("User 1", actual[0].Name);
            Assert.AreEqual(274.4, actual[0].KudosAmount);
            Assert.AreEqual("User 3", actual[1].Name);
            Assert.AreEqual(34, actual[1].KudosAmount);
            Assert.AreEqual("User 2", actual[2].Name);
            Assert.AreEqual(20, actual[2].KudosAmount);
            Assert.AreEqual("User 4", actual[3].Name);
            Assert.AreEqual(10, actual[3].KudosAmount);
        }