Beispiel #1
0
        string GenerateBanner(AppResponseTime time, AppResponseSize size)
        {
            var preTxt = _banner.GeneratedBanner(time);
            var banner = new HtmlBanner(preTxt, _prefixSize, _suffix);

            return(banner.GeneratedBanner(size));
        }
Beispiel #2
0
        public void GetAppData_for_valid()
        {
            // arrange
            var sizeRepo = NewResponseSizeRepo(Common.GetMockAppRepo());
            var data     = new AppResponseSize()
            {
                AppId        = DefaultAppId,
                ModifiedDate = DateTime.UtcNow,
                Recent       = 10,
                Min          = 5,
                Max          = 20,
                Total        = 6,
                Scale        = Size.KB
            };

            data = sizeRepo.AddAppData(data);

            // act
            var actual = sizeRepo.GetAppData(data.Id);

            // assert
            Assert.NotNull(actual);
            Assert.NotSame(actual, data);
            Assert.Equal(actual.Id, data.Id);
            Assert.True(actual.Id > 0);
            Assert.True(actual.AppId == data.AppId);
            Assert.True(actual.Recent == data.Recent);
        }
Beispiel #3
0
        public void UpdateRecentByAppId_for_existing_app()
        {
            // arrange
            var sizeRepo = NewResponseSizeRepo(Common.GetMockAppRepo());
            var data     = new AppResponseSize()
            {
                AppId        = DefaultAppId,
                ModifiedDate = DateTime.UtcNow,
                Recent       = 10,
                Min          = 10,
                Max          = 10,
                Avg          = 10,
                Total        = 1,
                Scale        = Size.GB
            };

            data = sizeRepo.AddAppData(data);

            // act
            var actual = sizeRepo.UpdateRecentByAppId(data.AppId, 0);

            // assert
            Assert.NotNull(actual);
            Assert.NotSame(actual, data);
            Assert.Equal(actual.Id, data.Id);
            Assert.True(actual.Id > 0);
            Assert.True(actual.AppId == data.AppId);
            Assert.True(actual.Recent == 0);
        }
Beispiel #4
0
        public AppResponseTime UpdateAndGet(ResponseLog log, out AppResponseSize responseSize)
        {
            if (log == default(ResponseLog))
            {
                throw new ArgumentNullException(nameof(log));
            }

            var rtn = _appResponse.UpdateRecentByAppId(log.AppId, log.ResponseTime);

            responseSize = _appSize.UpdateRecentByAppId(log.AppId, log.ByteSent);

            _log.Log(log);

            return(rtn);
        }