Пример #1
0
        public void Setup()
        {
            //initialize crypto module


            //setup logging
            Console.WriteLine("STARTING");
            String  sLoggerConfigFile = AgentTestUtils.buildOutputPath("logger.log");
            LogBase log = LogFactory.GetInstance.CreateSimple(sLoggerConfigFile, true, LogSeverity.SEV_INFO);

            Log.SetSingleton(log);
            Log.LogInfo("ISAgentTestSetup", "We configured the logger successfully!");
        }
Пример #2
0
        public static Agent getTestAgent(AgentConfig config = null)
        {
            Agent agent = new Agent();
            DeviceProfilePersistorPlaintext persistor = new DeviceProfilePersistorPlaintext();

            persistor.FilePath = AgentTestUtils.buildInputPath("plaintext.sep");
            if (config != null)
            {
                agent.Initialize(config, persistor);
            }
            else
            {
                agent.Initialize(persistor);
            }
            return(agent);
        }
        public void AgentCreateDevice()
        {
            AgentConfig config = new AgentConfig();
            Agent       agent  = AgentTestUtils.getTestAgent(config);

            CreateDeviceRequest request = new CreateDeviceRequest();

            //request.SetServer("https://api.ionic.engineering");
            request.Server  = "https://api.ionic.com";
            request.ETag    = "XyZ";
            request.UidAuth = "username@domain";
            request.Token   = "abCDEfghiJkLmNOp123=";
            request.EiRsaPublicKeyBase64 = "{A very long public key without newlines}";

            CreateDeviceResponse response = agent.CreateDevice(request);

            Assert.That(response.HttpResponseCode == 200, Is.True);
        }