public void LoadFromFileShouldPass() { string randFileName = RandomString(6) + ".json"; File.WriteAllText(randFileName, "[ {\"nodeid\": \"node-3\",\"key\": \"BdrwegfSDFG=\"},{\"nodeid\": \"node-12\",\"key\": \"BgIA345nlikrwegfSDFG=\"}]"); IPublickeySource obj = JsonPublicKeySource.FromFile(randFileName); string key = obj.GetKeyForNode("node-3"); Assert.Equal("BdrwegfSDFG=", key); //removing temp file File.Delete(randFileName); }
/// <summary> /// Constructor of KeyManagement /// </summary> /// <param name="config">Expects ConfigurationRoot as input</param> /// <param name="keystore">Expects PublickeySource as input</param> /// <returns>Instance of KeyManagement</returns> public KeyManagement(IConfigurationRoot config, IPublickeySource keystore) { _config = config; _keystore = keystore; }
/// <summary> /// IngressController constructor for Controller initialization /// </summary> /// <param name="keystore">PublickeySource instance reference</param> /// <param name="influx">InfluxClient instance reference, that will be used for data persistance</param> /// <returns>returns instance of IngressController</returns> public IngressController(IPublickeySource keystore, IInfluxClient influx) { _keyStore = keystore; _influx = influx; }