예제 #1
0
        public async Task AddSetting_ShouldAddSetting()
        {
            // Arange
            ApplicationDbContext context = InMemoryFactory.InitializeContext();

            var service      = new SettingService(context);
            var initialCount = context.Settings.Count();

            // Act
            await service.AddAsync("Key", "Value", "string");

            // Assert
            Assert.AreEqual(initialCount + 1, context.Settings.Count());
        }
예제 #2
0
        public async Task AddAsyncTest()
        {
            var id     = Guid.NewGuid().ToString();
            var source = new Setting();

            source.Id         = id;
            source.Value      = "123";
            source.CreateTime = DateTime.Now;
            var result = await service.AddAsync(source);

            Assert.IsTrue(result);

            var setting = fsq.Select <Setting>(new  {
                Id = id
            }).ToOne();

            Assert.IsNotNull(setting);

            Assert.AreEqual(source.Id, setting.Id);
            Assert.AreEqual(source.Value, setting.Value);
        }