Exemplo n.º 1
0
        public void should_return_saved_category()
        {
            CategoryEdit categoryEdit = new()
            {
                Id   = -123,
                Name = "test name",
            };
            CategoryDb categoryDb     = categoryEdit.MapToCategoryDb();
            Category   mappedCategory = categoryDb.MapToCategory();

            _categories.Setup(n => n.Update(categoryDb)).Returns(categoryDb);
            _mapper.Setup(n => n.Map <CategoryDb>(categoryEdit)).Returns(categoryDb);
            _mapper.Setup(n => n.Map <Category>(categoryDb)).Returns(mappedCategory);

            var result = _sut.Save(categoryEdit);

            result.Should().BeEquivalentTo <Category>(new()
            {
                Id   = -123,
                Name = "test name"
            });
        }