Exemple #1
0
        private async Task TestGetPhilosophyFacts_WithTestData_ShouldReturnNull()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

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

            Assert.True(philosophyFacts == null, "Method GetPhilosophyFacts() does not work correctly");
        }
Exemple #2
0
        private async Task TestGetPhilosophyFacts_WithTestData_ShouldReturnContent()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

            await SeedFacts(context);

            var philosophyFact  = (await factService.GetPhilosophyFactsAsync()).FirstOrDefault();
            var expectedContent = "Който не обича самотата не обича и свободата";
            var expectedAuthor  = "Шопенхауер";

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

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