示例#1
0
        public void Abc()
        {
            var agentId     = Guid.NewGuid();
            var decomponser = new DecomposerStub(agentId).WithHD();

            var hdScanTargets = new[]
            {
                new ScanTarget(agentId, "192.168.2.0"),
                new ScanTarget(agentId, "192.168.2.1"),
                new ScanTarget(agentId, "192.168.2.2"),
            };

            var actorRepositoryStub = new AgentGatewayActorRepositoryStub()
                                      .WithCreateActorFunc(
                id => new AgentGatewayActorStub(id).WithJobResultsFunc(sj => GetHDJobResults(sj, hdScanTargets)));

            var taskId      = Guid.NewGuid();
            var testContext = new TestContext(decomponser, actorRepositoryStub)
                              .WithAgent(agentId)
                              .WithTask(taskId);

            var taskRunId = Guid.NewGuid();

            testContext.Dispatch(new Notification(ActorTypes.Task, taskId, new RunTask(taskId, taskRunId, true)));

            Assert.True(testContext.WaitTaskRunFinished(taskRunId, 5));
            Assert.True(testContext.WaitJobsFinished(taskRunId, hdScanTargets, 5));
        }
示例#2
0
        public void Pentest()
        {
            var agentId    = Guid.NewGuid();
            var decomposer = new DecomposerStub(agentId).WithTargets(2);

            var taskId      = Guid.NewGuid();
            var testContext = new TestContext(decomposer, new AgentGatewayActorRepositoryStub())
                              .WithAgent(agentId)
                              .WithTask(taskId);

            var taskRunId = Guid.NewGuid();

            testContext.Dispatch(new Notification(ActorTypes.Task, taskId, new RunTask(taskId, taskRunId, false)));

            Assert.True(testContext.WaitTaskRunFinished(taskRunId, 5));
        }