Ejemplo n.º 1
0
        private async Task TestGetMathemtaticsFacts_WithTestData_ShouldReturnNull()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

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

            Assert.True(philosophyFacts == null, "Method GetMathematicsFacts() does not work correctly");
        }
Ejemplo n.º 2
0
        private async Task TestGetMathematicsFact_WithTestData_ShouldReturnContent()
        {
            var context     = PMGDbContextInMemoryFactory.CreateDbContext();
            var factService = new FactService(context);

            await SeedFacts(context);

            var mathematicsFact = (await factService.GetMathematicsFactsAsync()).FirstOrDefault();
            var expectedContent = "Math is life";
            var expectedAuthor  = "Somebody";

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

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