Пример #1
0
        public async Task Update_Book_ReleaseYear()
        {
            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.ReleaseYear.Should().Be(2019);

            await BookHelpers.UpdateReleaseYear(sut.Id, 1920);

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

            sut.ReleaseYear.Should().Be(1920);
            sut.Id.Should().Be(bookId);
        }