public CollectInfo CreateCollectInfoFromCollectRequest(CollectRequest collectRequest)
        {
            CollectInfo collectInfoDTO = new CollectInfo();
            collectInfoDTO.Address = collectRequest.Target.Address;
            collectInfoDTO.ReceivedOn = collectRequest.ReceivedOn;
            collectInfoDTO.CollectRequestId = collectRequest.Oid.ToString();
            collectInfoDTO.ClientId = collectRequest.ClientId;
            collectInfoDTO.Status = collectRequest.Status;

            return collectInfoDTO;
        }
Beispiel #2
0
        public ModSicConnection CreateModSicServiceToSendCollectAndWaitItsCompletion()
        {
            var fakeRequestInfo = CreateRequestInfo(Guid.NewGuid().ToString(), FAKE_COLLECT_REQUEST_ID);
            var fakeSendCollectResult = new SendRequestResult() { Requests = new RequestInfo[] { fakeRequestInfo } };

            var fakeCollectInfo0 = CreateCollectInfo("10.1.0.1", "CollectRequests/1");
            var fakeCollectInfo1 = CreateCollectInfo("10.1.1.1", FAKE_COLLECT_REQUEST_ID);
            var fakeCollectInfo2 = CreateCollectInfo("10.1.1.2", "CollectRequests/1025");
            var fakeCollectionsInExecution = new CollectInfo[] { fakeCollectInfo0, fakeCollectInfo1, fakeCollectInfo2 };

            var mocks = new MockRepository();
            var api = mocks.StrictMock<ModSicConnection>(new string[] { "", "", "", "" });
            Expect.Call(api.SendCollect(null, null, null, null, null)).IgnoreArguments().Return(fakeSendCollectResult);
            Expect.Call(api.GetCollectionsInExecution()).Repeat.Times(5).Return(fakeCollectionsInExecution);
            Expect.Call(api.GetCollectionsInExecution()).Return(new CollectInfo[] { fakeCollectInfo2 });
            Expect.Call(api.GetOvalResults(FAKE_COLLECT_REQUEST_ID)).Return(FAKE_OVAL_RESULTS);
            mocks.ReplayAll();

            return api;
        }
Beispiel #3
0
        public ModSicService CreateModSicServiceToGetCollectionsInExecutions()
        {
            var mocks = new MockRepository();
            var mockAPI = mocks.DynamicMock<ModSicConnection>(new string[] { "", "", "", "" });
            var fakeCollectionsInExecutions =
                new CollectInfo[]
                {
                    CreateCollectInfo("10.1.0.1", "CollectRequests/2048"),
                    CreateCollectInfo("10.1.0.2", "CollectRequests/2049")
                };
            Expect.Call(mockAPI.GetCollectionsInExecution()).Return(fakeCollectionsInExecutions);
            mocks.ReplayAll();

            return new ModSicService(mockAPI);

        }