Example #1
0
        public HeardBackDTO HeardBack(Format format)
        {
            int totalAppCount   = _appRepo.GetTotalAppCount();
            int pendingAppCount = _appRepo.GetPendingAppCount();
            int heardBackCount  = totalAppCount - pendingAppCount;


            var result = new HeardBackDTO(format.ToString(),
                                          CalculateHeardBack(format, totalAppCount, heardBackCount));

            return(result);
        }
Example #2
0
        public void HeardBack_CorrectDecimal()
        {
            int numeratorCompliment = 2, denominator = 3;
            var mockAppRepo = new Mock <IApplicationRepo>();

            mockAppRepo.Setup(r => r.GetTotalAppCount()).Returns(denominator);
            mockAppRepo.Setup(r => r.GetPendingAppCount()).Returns(numeratorCompliment);
            var provider   = new MetricsProvider(mockAppRepo.Object);
            var formatEnum = Format.Decimal;
            var expected   = new HeardBackDTO(formatEnum.ToString(), (decimal)0.33);

            var actual = provider.HeardBack(formatEnum);

            Assert.Equal(expected.format, actual.format);
            Assert.Equal(expected.value, actual.value);
        }