private async Task GetDictionaryElementAsync <T>() where T : DictionaryElementBase, new() { using var context = PrepareData.GetDbContext(); var service = new GenericDictionaryService <T>(context); var result = await service.GetDictionaryElementAsync(2137); Assert.True(result.IsLeft); }
private async Task GetDictionaryElementGenericAsync <T>(string name) where T : DictionaryElementBase, new() { using var context = PrepareData.GetDbContext(); var service = new GenericDictionaryService <T>(context); var dictionaryElement = context.Set <T>().FirstOrDefault(e => e.Name == name); var dictionaryElementDTO = await service.GetDictionaryElementAsync(dictionaryElement.Id); Assert.True(dictionaryElementDTO.IsRight); dictionaryElementDTO.IfRight(r => { Assert.Equal(dictionaryElement.Id, r.Id); Assert.Equal(dictionaryElement.Name, r.Name); }); }