Exemplo n.º 1
0
        public void GetAppData_for_valid()
        {
            // arrange
            var responseRepo = NewResponseTimeRepo(Common.GetMockAppRepo());
            var data         = new AppResponseTime()
            {
                AppId        = DefaultAppId,
                ModifiedDate = DateTime.UtcNow,
                Recent       = 10,
                Min          = 5,
                Max          = 20,
                Total        = 6,
                Slice        = TimeSlice.Milliseconds
            };

            data = responseRepo.AddAppData(data);

            // act
            var actual = responseRepo.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);
            Assert.True(actual.Slice == data.Slice);
        }
Exemplo n.º 2
0
        string GenerateBanner(AppResponseTime time, AppResponseSize size)
        {
            var preTxt = _banner.GeneratedBanner(time);
            var banner = new HtmlBanner(preTxt, _prefixSize, _suffix);

            return(banner.GeneratedBanner(size));
        }
Exemplo n.º 3
0
        public void UpdateRecentByAppId_for_existing_app()
        {
            // arrange
            var responseRepo = NewResponseTimeRepo(Common.GetMockAppRepo());
            var data         = new AppResponseTime()
            {
                AppId        = DefaultAppId,
                ModifiedDate = DateTime.UtcNow,
                Recent       = 10,
                Min          = 10,
                Max          = 10,
                Avg          = 10,
                Total        = 1,
                Slice        = TimeSlice.Milliseconds
            };

            data = responseRepo.AddAppData(data);

            // act
            var actual = responseRepo.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);
            Assert.True(actual.Slice == data.Slice);
        }