Exemple #1
0
        public async Task Update_Book_WordCount()
        {
            var book = await BookHelpers.CreateValidBookWithAllProperties();

            var repository = new BookRepository(_fixture.Context);

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

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

            var bookId = sut.Id;

            sut.Should().NotBeNull();
            sut.WordCount.Should().Be(61_500);

            await BookHelpers.UpdateWordCount(sut.Id, 150_600);

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

            sut.WordCount.Should().Be(150_600);
            sut.Id.Should().Be(bookId);
        }