コード例 #1
0
ファイル: FactServiceTests.cs プロジェクト: Lyubo03/PMG
        private async Task TestGetEnglishFacts_WithTestData_ShouldReturnNull()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

            var philosophyFacts = (await factService.GetEnglishFactsAsync()).FirstOrDefault();

            Assert.True(philosophyFacts == null, "Method GetEnglishFacts() does not work correctly");
        }
コード例 #2
0
ファイル: FactServiceTests.cs プロジェクト: Lyubo03/PMG
        private async Task TestGetEnglishFact_WithTestData_ShouldReturnContent()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

            await SeedFacts(context);

            var englishSlang    = (await factService.GetEnglishFactsAsync()).FirstOrDefault();
            var expectedContent = "To turn into peaces";
            var expectedAuthor  = "Break";

            var actualContent = englishSlang.Content;
            var actualAuthor  = englishSlang.Author;

            Assert.Equal(expectedContent, actualContent);
            Assert.Equal(expectedAuthor, actualAuthor);
        }