public async Task CreateChoiceTemplateAsync_NewDto_ReturnsRegisteredDto() { var target = new CategoryRepository(_context, _mapper); var dto = new ChoiceTemplateDto { Choices = new List <OptionDto> { new OptionDto { Description = "choice1" }, new OptionDto { Description = "choice2" } } }; var actualDto = await target.CreateChoiceTemplateAsync(dto); var choices = new List <string> { "choice1", "choice2" }; Assert.NotEqual(0, actualDto.ChoiceTemplateId); Assert.DoesNotContain(actualDto.Choices, x => x.OptionId == 0); Assert.Contains(actualDto.Choices, x => choices.Contains(x.Description)); var actualEntity = _context.ChoiceTemplates.First(); Assert.NotEqual(0, actualEntity.ChoiceTemplateId); Assert.DoesNotContain(actualEntity.Choices, x => x.OptionId == 0); Assert.Contains(actualEntity.Choices, x => choices.Contains(x.Description)); }