Example #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);
        }
Example #2
0
        public async Task Language_inserted_to_database()
        {
            var language = await LanguageHelpers.CreateValidLanguage();

            var repository = new LanguageRepository(_fixture.Context);

            (await repository.ExistsAsync(language.Id)).Should().BeTrue();
        }
Example #3
0
        public async Task Update_Language()
        {
            var language = await LanguageHelpers.CreateValidLanguage();

            language.Name.Should().Be("pig latin");

            var sut = Language.Create(language.Id, "english");

            await LanguageHelpers.UpdateLanguage(sut);

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

            language.Name.Should().Be("english");
        }
Example #4
0
        public async Task Remove_Language()
        {
            var language = await LanguageHelpers.CreateValidLanguage();

            var repository = new LanguageRepository(_fixture.Context);

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

            await LanguageHelpers.RemoveLanguage(language.Id);

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

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

            (await repository.ExistsAsync(language.Id)).Should().BeFalse();
        }