示例#1
0
        private async Task AddKey <T>(string name) where T : DictionaryElementBase, new()
        {
            using var context = PrepareData.GetDbContext(); var service = new GenericDictionaryService <T>(context);
            var dictionaryElement = new DictionaryElementCreateDTO()
            {
                Name = name
            };
            var result = await service.AddKey(dictionaryElement);

            Assert.True(result.IsLeft);
        }
示例#2
0
        private async Task AddKeyGeneric <T>() where T : DictionaryElementBase, new()
        {
            using var context = PrepareData.GetDbContext(); var service = new GenericDictionaryService <T>(context);
            var dictionaryElement = new DictionaryElementCreateDTO()
            {
                Name = "elo"
            };
            var result = await service.AddKey(dictionaryElement);

            Assert.True(result.IsRight);
            var value = context.Set <T>().FirstOrDefault(e => e.Name == dictionaryElement.Name);

            Assert.NotNull(value);
        }