Example #1
0
        public void SelectsFirstMatchingOrchestrator(string firstActionName, string secondActionName, int firstCount, int secondCount)
        {
            //arrange
            var orchestrator1 = Get.MotherFor.MockAnarchyActionOrchestrator.OrchestratorWithScheduleNamed(firstActionName).Build();
            var orchestrator2 = Get.MotherFor.MockAnarchyActionOrchestrator.OrchestratorWithScheduleNamed(secondActionName).Build();
            var sut           = new AnarchyManagerNew(new [] { orchestrator1, orchestrator2 });

            //act
            sut.AssignTargetPattern("firstActionName", ".*");

            //assert
            orchestrator1.Received(firstCount).ForTargetPattern(".*");
            orchestrator2.Received(secondCount).ForTargetPattern(".*");
        }
Example #2
0
        public void MatchingOrchestrator(string anarchyType)
        {
            //arrange
            var orchestrator = Get.MotherFor
                               .MockAnarchyActionOrchestrator
                               .OrchestratorWithScheduleNamed("testAnarchyType").Build();
            var sut = new AnarchyManagerNew(new [] { orchestrator });

            //act
            sut.AssignTargetPattern(anarchyType, ".*");

            //assert
            orchestrator.Received(1).ForTargetPattern(".*");
        }
Example #3
0
        public void NoMatchingOrchestrator(string anarchyType)
        {
            //arrange
            var orchestrator = Get.MotherFor
                               .MockAnarchyActionOrchestrator
                               .OrchestratorWithScheduleNamed("testAnarchyType").Build();
            var sut = new AnarchyManagerNew(new [] { orchestrator });

            //act
            var exception = Assert.Catch(() => sut.AssignTargetPattern(anarchyType, ".*"));

            //assert
            exception.Should().BeOfType <AnarchyActionNotFoundException>();
            orchestrator.Received(0).AssociateSchedule(Arg.Any <Schedule>());
        }