Exemple #1
0
        public async Task Update_Book_Language()
        {
            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.Language.Should().BeNull();

            var language = await LanguageHelpers.CreateValidLanguage();

            await BookHelpers.UpdateLanguage(sut.Id, language);

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

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

            sut.Language.Id.Should().Be(language.Id);
            sut.Language.Name.Should().Be(language.Name);
            sut.Id.Should().Be(bookId);
        }