Esempio n. 1
0
        public void GetNext_WhenBranchingHierarcy_ReturnsExpectedOrder()
        {
            //Prepare
            var category = new EntityDescription <Category>()
                           .SetTargetCount(1);
            var post = new EntityDescription <Post>()
                       .SetTargetCount(3)
                       .SetRequired(typeof(Category));
            var comment = new EntityDescription <Comment>()
                          .SetTargetCount(2)
                          .SetRequired(typeof(Post));
            var attachment = new EntityDescription <Attachment>()
                             .SetTargetCount(2)
                             .SetRequired(typeof(Post));
            var descriptions = new List <IEntityDescription>
            {
                category,
                post,
                comment,
                attachment
            };
            CompleteSupervisor target = SetupCompleteOrderProvider(descriptions);

            //Invoke
            List <ICommand> actualCommands = GetNextList(target);

            //Assert
            Assert.IsNotNull(actualCommands);
            AssertPlanCount(descriptions, actualCommands);
        }
Esempio n. 2
0
        //Setup helpers
        private CompleteSupervisor SetupCompleteOrderProvider(
            List <IEntityDescription> descriptions)
        {
            var generatorSetup = new GeneratorSetup();
            Dictionary <Type, IEntityDescription> dictDescriptions =
                descriptions.ToDictionary(x => x.Type, x => x);
            Dictionary <Type, EntityContext> contexts =
                generatorSetup.SetupEntityContexts(dictDescriptions);

            var target = new CompleteSupervisor();

            target.Setup(generatorSetup, contexts);
            return(target);
        }