コード例 #1
0
        public async void Tags_AddTagDBAsync_Positive_Test()
        {
            var options = new DbContextOptionsBuilder <DreamFoodDeliveryContext>()
                          .UseInMemoryDatabase(databaseName: "Tags_AddTagDBAsync_Positive_Test")
                          .Options;

            using (var context = new DreamFoodDeliveryContext(options))
            {
                var    service = new TagService(_mapper, context);
                string newTag  = "NewTag";

                TagToAdd tag = new TagToAdd()
                {
                    TagName = newTag,
                };

                var resultPositive = await service.AddTagDBAsync(tag);

                resultPositive.IsSuccess.Should().BeTrue();
                resultPositive.Data.TagName.Should().BeEquivalentTo(tag.TagName);
            }
        }