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

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

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

            await SeedFacts(context);

            var physicsFact     = (await factService.GetPhysicsFactsAsync()).FirstOrDefault();
            var expectedContent = "Physics is beautiful";
            var expectedAuthor  = "Man";

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

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