示例#1
0
        public void Delivers_content(int nodeId, KnowledgeNodeProgressDTO expectedNode)
        {
            using var scope = _factory.Services.CreateScope();
            var controller = new ProgressController(_factory.Services.GetRequiredService <IMapper>(),
                                                    scope.ServiceProvider.GetRequiredService <IProgressService>());

            var actualNode = ((OkObjectResult)controller.GetNodeContent(nodeId).Result).Value as KnowledgeNodeProgressDTO;

            actualNode.Status.ShouldBe(expectedNode.Status);
            var actualLOIds   = actualNode.LearningObjects.Select(lo => lo.Id);
            var expectedLOIds = expectedNode.LearningObjects.Select(lo => lo.Id);

            actualLOIds.Count().ShouldBe(expectedLOIds.Count());
            actualLOIds.All(expectedLOIds.Contains).ShouldBeTrue();
        }