コード例 #1
0
        public async Task <IActionResult> All()
        {
            var configs = await _configService.GetAllConfigsAsync();

            return(Json(new
            {
                success = true,
                data = configs
            }));
        }
コード例 #2
0
        public async Task GetAllConfigsAsyncTest()
        {
            fsq.Delete <Config>().Where("1=1").ExecuteAffrows();

            var id     = Guid.NewGuid().ToString();
            var source = new Config
            {
                AppId        = "001",
                Id           = id,
                Group        = "g",
                Key          = "k",
                Value        = "v",
                Description  = "d",
                CreateTime   = DateTime.Now,
                UpdateTime   = DateTime.Now,
                Status       = ConfigStatus.Enabled,
                OnlineStatus = OnlineStatus.Online
            };
            var id1     = Guid.NewGuid().ToString();
            var source1 = new Config
            {
                AppId        = "001",
                Id           = id1,
                Group        = "g",
                Key          = "k",
                Value        = "v",
                Description  = "d",
                CreateTime   = DateTime.Now,
                UpdateTime   = DateTime.Now,
                Status       = ConfigStatus.Deleted,
                OnlineStatus = OnlineStatus.Online
            };
            var result = await service.AddAsync(source);

            Assert.IsTrue(result);
            var result1 = await service.AddAsync(source1);

            Assert.IsTrue(result1);

            var configs = await service.GetAllConfigsAsync();

            Assert.IsNotNull(configs);
            Assert.AreEqual(1, configs.Count);
        }