Example #1
0
        public async Task CreateAsync()
        {
            // Arrange
            var input = new TagCreateDto
            {
                Name = "40cfea20f3034ca7890cb2476"
            };

            // Act
            var serviceResult = await _tagAppService.CreateAsync(input);

            // Assert
            var result = await _tagRepository.FindAsync(c => c.Id == serviceResult.Id);

            result.ShouldNotBe(null);
            result.Name.ShouldBe("40cfea20f3034ca7890cb2476");
        }
Example #2
0
        public async Task Should_Create_A_Tag()
        {
            var name        = "test name";
            var description = "test description";

            var tagDto = await _tagAppService.CreateAsync(new CreateTagDto()
            {
                Name = name, Description = description
            });

            UsingDbContext(context =>
            {
                var tag = context.Tags.FirstOrDefault(q => q.Id == tagDto.Id);
                tag.ShouldNotBeNull();
                tag.Name.ShouldBe(tagDto.Name);
                tag.Description.ShouldBe(tagDto.Description);
            });
        }
Example #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            await _tagAppService.CreateAsync(Tag);

            return(NoContent());
        }