public void AddSocket(Socket socket, IEnumerable <SensorParameter> parameters) { var parser = new KeyloggerSettingsParser(); var settings = parser.ParseSocketSettings(parameters); _stateStore.SetSettings(socket, settings); }
public void Parse_OffDelayNotDefined() { var defaultSettings = KeyloggerSocketSettings.GetDefault(); var parser = new KeyloggerSettingsParser(); var result = parser.ParseSocketSettings(new List <SensorParameter>()); Assert.Equal(defaultSettings.OffDelay, result.OffDelay); }
public void Parse_OffDelay() { var parser = new KeyloggerSettingsParser(); var result = parser.ParseSocketSettings(new List <SensorParameter>() { new SensorParameter("OffDelaySeconds", "60") }); Assert.Equal(TimeSpan.FromSeconds(60), result.OffDelay); }
public void Parse_OffDelayInvalidValue() { var defaultSettings = KeyloggerSocketSettings.GetDefault(); var parser = new KeyloggerSettingsParser(); var result = parser.ParseSocketSettings(new List <SensorParameter>() { new SensorParameter("OffDelaySeconds", "-1") }); Assert.Equal(defaultSettings.OffDelay, result.OffDelay); }
public void Parse_OffDelayMultipleDefined() { var defaultSettings = KeyloggerSocketSettings.GetDefault(); var parser = new KeyloggerSettingsParser(); var result = parser.ParseSocketSettings(new List <SensorParameter>() { new SensorParameter("OffDelaySeconds", "60"), new SensorParameter("OffDelaySeconds", "90") }); Assert.Equal(defaultSettings.OffDelay, result.OffDelay); }