コード例 #1
0
        public void Handle_GetBookQuery_Book_Not_Exists()
        {
            // arrange
            var key = MockBuilder.Key;

            var book = BookMock.Get(key);

            MockRepository.Add(book);

            MockRepository.Commit();

            var key2  = MockBuilder.Key;
            var query = GetBookQueryMock.Get(key2);

            // act
            var dto = Handle(query);

            dto.Should().BeNull();
        }
コード例 #2
0
        public void Handle_GetBookQuery_Default()
        {
            // arrange
            var key = MockBuilder.Key;

            var book = BookMock.Get(key);

            MockRepository.Add(book);

            MockRepository.Commit();

            var query = GetBookQueryMock.Get(key);

            // act
            var dto = Handle(query);

            dto.Should().NotBeNull();

            var dtoExpected = BookDtoMock.Get(key);

            dto.Should().BeEquivalentTo(dtoExpected);
        }