public PerfLogAssemblyRepositoryTest()
        {
            var option         = DbContextOptionsBuilderFactory.Create();
            var arrangeContext = new HippologamusContext(option);

            arrangeContext.Add(new PerfLog()
            {
                Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Assembly = "a"
            });
            arrangeContext.SaveChanges();
            _context = new HippologamusContext(option);
        }
        public PerfLogPerformanceItemRepositoryTest()
        {
            var option         = DbContextOptionsBuilderFactory.Create();
            var arrangeContext = new HippologamusContext(option);

            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "PerfLogs-Get", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.SaveChanges();
            _context = new HippologamusContext(option);
        }
示例#3
0
        public PerfLogRepositoryTest()
        {
            var option         = DbContextOptionsBuilderFactory.Create();
            var arrangeContext = new HippologamusContext(option);

            arrangeContext.Add(new PerfLog()
            {
                Id = 1, ElapsedMilliseconds = 50, MachineName = "PC-A", TimeStamp = new DateTime(2020, 1, 1), PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 2, ElapsedMilliseconds = 60, MachineName = "PC-B", TimeStamp = new DateTime(2020, 1, 2), PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 3, ElapsedMilliseconds = 51, MachineName = "PC-C", TimeStamp = new DateTime(2020, 1, 3), PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 4, ElapsedMilliseconds = 61, MachineName = "PC-A", TimeStamp = new DateTime(2020, 1, 4), PerfItem = "PerfLogs-GetById", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 5, ElapsedMilliseconds = 52, MachineName = "PC-B", TimeStamp = new DateTime(2020, 1, 5), PerfItem = "PerfLogs-Get", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 6, ElapsedMilliseconds = 62, MachineName = "PC-C", TimeStamp = new DateTime(2020, 1, 6), PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.Add(new PerfLog()
            {
                Id = 7, ElapsedMilliseconds = 53, MachineName = "PC-A", TimeStamp = new DateTime(2020, 1, 7), PerfItem = "Beatle-Get", Assembly = "Demo.API"
            });
            arrangeContext.SaveChanges();
            _context = new HippologamusContext(option);
        }
示例#4
0
        public async Task GetByBaseTypeAsync(string baseType, int expected)
        {
            //arrange
            var option         = DbContextOptionsBuilderFactory.Create();
            var arrangeContext = new PizzaContext(option);

            arrangeContext.PizzaOrders.Add(new Model.PizzaOrder()
            {
                BaseType = "thick"
            });
            arrangeContext.PizzaOrders.Add(new Model.PizzaOrder()
            {
                BaseType = "thick"
            });
            arrangeContext.PizzaOrders.Add(new Model.PizzaOrder()
            {
                BaseType = "thick"
            });
            arrangeContext.PizzaOrders.Add(new Model.PizzaOrder()
            {
                BaseType = "thin"
            });
            arrangeContext.PizzaOrders.Add(new Model.PizzaOrder()
            {
                BaseType = "thin"
            });
            arrangeContext.SaveChanges();

            var context = new PizzaContext(option);
            var pizzaOrderRepository = new PizzaOrderRepository(context);
            //act
            var value = await pizzaOrderRepository.GetByBaseType(baseType);

            //assert
            Assert.AreEqual(expected, value.Count());
        }
        public DetailLogRepositoryTest_GetAllErrors()
        {
            var option         = DbContextOptionsBuilderFactory.Create();
            var arrangeContext = new HippologamusContext(option);

            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 1), Level = "Error", RequestPath = "/api/beatle", Assembly = "Demo.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 2), Level = "Error", RequestPath = "/api/PerfLogs", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 3), Level = "Error", RequestPath = "/api/PerfLogs", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 4), Level = "Error", RequestPath = "/api/PerfLogs", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 5), Level = "Information", RequestPath = "/api/PerfLogs", Assembly = "Hippologamus.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 6), Level = "Error", RequestPath = "/api/beatle/2", Assembly = "Demo.API"
            });
            arrangeContext.Add(new DetailLog()
            {
                TimeStamp = new DateTime(2020, 1, 7), Level = "Error", RequestPath = "/api/beatle", Assembly = "Demo.API"
            });
            arrangeContext.SaveChanges();
            _context = new HippologamusContext(option);
        }