Esempio n. 1
0
        public async Task Update_Book_Publisher()
        {
            var book = await BookHelpers.CreateValidBook();

            var repository = new BookRepository(_fixture.Context);

            (await repository.ExistsAsync(book.Id)).Should().BeTrue();

            var sut = await repository.LoadAsync(book.Id);

            var bookId = sut.Id;

            sut.Should().NotBeNull();
            sut.Publisher.Should().BeNull();

            var publisher = await PublisherHelpers.CreateValidPublisher();

            await BookHelpers.UpdatePublisher(sut.Id, publisher);

            sut = await repository.LoadAsync(book.Id);

            await _fixture.Context.Entry(sut).ReloadAsync();

            sut.Publisher.Id.Should().Be(publisher.Id);
            sut.Publisher.Name.Should().Be(publisher.Name);
            sut.Id.Should().Be(bookId);
        }