Example #1
0
        public async Task ShouldHandleGetTagsQueryRequest()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: "ShouldHandleGetTagsQueryRequest")
                          .Options;

            using (var context = new AppDbContext(options))
            {
                var tag = new Tag()
                {
                    TagId = 1
                };

                tag.Update("Quinntyne");

                context.Tags.Add(tag);

                context.SaveChanges();

                var handler = new GetTagsQuery.Handler(context);

                var response = await handler.Handle(new GetTagsQuery.Request(), default(CancellationToken));

                Assert.Single(response.Tags);
            }
        }
Example #2
0
        public async Task ShouldHandleGetTagsQueryRequest()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: "ShouldHandleGetTagsQueryRequest")
                          .Options;

            using (var context = new AppDbContext(options))
            {
                context.Tags.Add(new Macaria.Core.Models.Tag()
                {
                    TagId = Guid.NewGuid(),
                    Name  = "Quinntyne",
                });

                context.SaveChanges();

                var handler = new GetTagsQuery.Handler(context);

                var response = await handler.Handle(new GetTagsQuery.Request(), default(CancellationToken));

                Assert.Single(response.Tags);
            }
        }