示例#1
0
        public void CreateRequest()
        {
            var startupService     = new StartupService();
            var requestManagerMock = new Mock <IRequestIdManager>();

            requestManagerMock.SetupGet(x => x.GetNextId).Returns(1);
            startupService.GetData(requestManagerMock.Object);
            var    request  = startupService.JsonString;
            string original =
                "[{\"__class__\":\"ServerRequest\",\"requestData\":[],\"requestClass\":\"StartupService\",\"requestMethod\":\"getData\",\"requestId\":1}]";

            Assert.AreEqual(original, request);
        }
示例#2
0
        public void Run()
        {
            Status = FoeTaskStatus.Running;
            var httpManager     = _diContainer.Resolve <IHttpRequestManager>();
            var httpManagerInit = _diContainer.Resolve <IRequestManagerInitializer>();
            var settings        = _diContainer.Resolve <ISettings>();
            var hashCreator     = _diContainer.Resolve <IHashCreator>();
            var uri             = settings.Gateway;

            var requestIdManager = _diContainer.Resolve <IRequestIdManager>();
            var startupService   = new StartupService();

            startupService.GetData(requestIdManager);
            var request = startupService.JsonString;

            var signature = hashCreator.GetSignature(request);

            httpManagerInit.InitializeHeader(signature);

            httpManager.SendPostRequest(uri, request, null, null, false);
            Status = FoeTaskStatus.Success;
        }