public void TestInitFull() { DesktopContext context = new DesktopContext() .SetOsType("OS-X") .SetOsVersion("10.10.5") .SetOsServicePack("Yosemite") .SetOsIs64Bit(true) .SetDeviceManufacturer("Apple") .SetDeviceModel("Macbook Pro") .SetDeviceProcessorCount(4) .Build(); Assert.NotNull(context); Dictionary <string, object> dict = context.GetData(); Assert.AreEqual(7, dict.Count); Assert.AreEqual("OS-X", dict [Constants.PLAT_OS_TYPE]); Assert.AreEqual("10.10.5", dict [Constants.PLAT_OS_VERSION]); Assert.AreEqual("Yosemite", dict [Constants.DESKTOP_SERVICE_PACK]); Assert.AreEqual(true, dict [Constants.DESKTOP_IS_64_BIT]); Assert.AreEqual("Apple", dict [Constants.PLAT_DEVICE_MANU]); Assert.AreEqual("Macbook Pro", dict [Constants.PLAT_DEVICE_MODEL]); Assert.AreEqual(4, dict [Constants.DESKTOP_PROC_COUNT]); Assert.AreEqual("iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0", context.GetSchema()); Assert.AreEqual("{\"data\":{\"osVersion\":\"10.10.5\", \"osServicePack\":\"Yosemite\", \"deviceManufacturer\":\"Apple\", \"deviceProcessorCount\":4, \"osIs64Bit\":true, \"deviceModel\":\"Macbook Pro\", \"osType\":\"OS-X\"}, \"schema\":\"iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0\"}", context.GetJson().ToString()); }
public WpfApp(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.Name, "MainWindow"); this.ClickButton = this.CreateControl <WpfButton>("ClicksBtn"); this.ClickLabel = this.CreateControl <WpfText>("ClicksLbl"); }
public WpfApp(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.Name, "MainWindow"); this.ClickButton = this.CreateControl<WpfButton>("ClicksBtn"); this.ClickLabel = this.CreateControl<WpfText>("ClicksLbl"); }
public void TestInitMinimal() { DesktopContext context = new DesktopContext().SetOsType("OS-X").SetOsVersion("10.10.5").Build(); Assert.NotNull(context); Dictionary <string, object> dict = context.GetData(); Assert.AreEqual(2, dict.Count); Assert.AreEqual("OS-X", dict [Constants.PLAT_OS_TYPE]); Assert.AreEqual("10.10.5", dict [Constants.PLAT_OS_VERSION]); Assert.AreEqual("iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0", context.GetSchema()); Assert.AreEqual("{\"data\":{\"osVersion\":\"10.10.5\", \"osType\":\"OS-X\"}, \"schema\":\"iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0\"}", context.GetJson().ToString()); }
public void testInitDesktopContext() { var dc = new DesktopContext() .SetOsType("Windows") .SetOsVersion("10") .SetOsServicePack("6") .SetOsIs64Bit(true) .SetDeviceManufacturer("Asus") .SetDeviceModel("unknown") .SetDeviceProcessorCount(8) .Build(); Assert.IsNotNull(dc); Assert.AreEqual(@"{""schema"":""iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0"",""data"":{""osType"":""Windows"",""osVersion"":""10"",""osServicePack"":""6"",""osIs64Bit"":true,""deviceManufacturer"":""Asus"",""deviceModel"":""unknown"",""deviceProcessorCount"":8}}", dc.GetJson().ToString()); }
public void Mutate_UpdateReportTasks() { IDesktopContext context = new DesktopContext(new DateTime(2018, 1, 1), null, null, "executingAssemblyPath", "ReferenceData", null, null, null) { KeyValuePairs = new Dictionary <string, object> { { ILRContextKeys.ReportTasks, "TestReport" }, }, }; var mutator = new SchemaErrorContextMutator(); context = mutator.Mutate(context); context.KeyValuePairs[ILRContextKeys.ReportTasks].Should().NotBe("TestReport"); context.KeyValuePairs[ILRContextKeys.ReportTasks].Should().Be(ReportTaskNameConstants.ValidationSchemaErrorReport); }
public void TwoPlusTwoEqualsFour_QuickAndDirty() { var calculator = new DesktopContext().Launch<WinWindow>(@"C:\Windows\system32\calc.exe"); calculator.SearchProperties.Add(WinWindow.PropertyNames.Name, "Calculator"); var twoBtn = calculator.CreateControl<WinButton>("2"); var plusBtn = calculator.CreateControl<WinButton>("Add"); var equalsBtn = calculator.CreateControl<WinButton>("Equals"); var resultTxt = calculator.CreateControl<WinText>("Result"); twoBtn.Click(); plusBtn.Click(); twoBtn.Click(); equalsBtn.Click(); Assert.AreEqual("4", resultTxt.DisplayText); }
public void TwoPlusTwoEqualsFour_QuickAndDirty() { var calculator = new DesktopContext().Launch <WinWindow>(@"C:\Windows\system32\calc.exe"); calculator.SearchProperties.Add(WinWindow.PropertyNames.Name, "Calculator"); var twoBtn = calculator.CreateControl <WinButton>("2"); var plusBtn = calculator.CreateControl <WinButton>("Add"); var equalsBtn = calculator.CreateControl <WinButton>("Equals"); var resultTxt = calculator.CreateControl <WinText>("Result"); twoBtn.Click(); plusBtn.Click(); twoBtn.Click(); equalsBtn.Click(); Assert.AreEqual("4", resultTxt.DisplayText); }
public void TestInitExceptions() { DesktopContext context = null; try { context = new DesktopContext().Build(); } catch (Exception e) { Assert.AreEqual("Desktop Context requires 'osType'.", e.Message); } Assert.IsNull(context); try { context = new DesktopContext().SetOsType("OS-X").Build(); } catch (Exception e) { Assert.AreEqual("Desktop Context requires 'osVersion'.", e.Message); } Assert.IsNull(context); }
public WinTabList(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "TabList"); }
public WinProgressBar(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "ProgressBar"); }
public WinRowHeader(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "RowHeader"); }
/// <summary> /// Adds the standard NV Pairs to the payload and stitches any available /// contexts to the final payload. /// </summary> /// <param name="payload">The basee event payload</param> /// <param name="contexts">The contexts array</param> /// <param name="eventId">The event ID</param> private void CompleteAndTrackPayload(Payload payload, List <IContext> contexts, string eventId) { payload.AddDict(_standardNvPairs); // Add the subject data if available if (_subject != null) { payload.AddDict(_subject._payload.Payload); } // Add the session context if available if (_clientSession != null) { contexts.Add(_clientSession.GetSessionContext(eventId)); } // Add the desktop context if available if (_desktopContextDelegate != null) { DesktopContext desktopContext = _desktopContextDelegate.Invoke(); if (desktopContext != null) { contexts.Add(desktopContext); } } // Add the mobile context if available if (_mobileContextDelegate != null) { MobileContext mobileContext = _mobileContextDelegate.Invoke(); if (mobileContext != null) { contexts.Add(mobileContext); } } // Add the geo-location context if available if (_geoLocationDelegate != null) { GeoLocationContext geoLocationContext = _geoLocationDelegate.Invoke(); if (geoLocationContext != null) { contexts.Add(geoLocationContext); } } // Build the final context and it to the payload if (contexts != null && contexts.Any()) { var contextArray = new List <Dictionary <string, object> >(); foreach (IContext context in contexts) { contextArray.Add(context.GetJson().Payload); } var contextEnvelope = new SelfDescribingJson(Constants.SCHEMA_CONTEXTS, contextArray); payload.AddJson(contextEnvelope.Payload, _encodeBase64, Constants.CONTEXT_ENCODED, Constants.CONTEXT); } // Send the payload to the emitter if (_synchronous) { _emitter.Input(payload); } else { Task.Factory.StartNew(() => _emitter.Input(payload)); } }
public WpfGroup(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Group"); }
public WinColumnHeader(DesktopContext context) : base(context) { this.SearchProperties.Add(new SearchProperty(WinControl.PropertyNames.ControlType, "ColumnHeader")); }
public WinComboBox(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "ComboBox"); }
public WinFormsApp(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.Name, "Form1"); }
public WpfTitleBar(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "TitleBar"); }
public WpfExpander(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Expander"); }
public WinCheckBoxTreeItem(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "CheckBoxTreeItem"); }
public DesktopControl(DesktopContext context, string technologyName) : base(context, Technology.Desktop) { this._technologyName = technologyName; }
public WinSeparator(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "Separator"); }
public WpfButton(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Button"); }
public WpfListItem(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "ListItem"); }
public WinToolTip(DesktopContext context) : base(context) { this.SearchProperties.Add(new SearchProperty(WinControl.PropertyNames.ControlType, "ToolTip")); }
public WinPane(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "Pane"); }
public WpfTreeItem(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "TreeItem"); }
public WinMenuBar(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "MenuBar"); }
public WinRadioButton(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "RadioButton"); }
public WinDateTimePicker(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "DateTimePicker"); }
public WpfWindow(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Window"); }
public WinListItem(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "ListItem"); }
public WpfRadioButton(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "RadioButton"); }
public WinControl(DesktopContext context) : base(context, "MSAA") { }
public WpfHyperlink(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Hyperlink"); }
public WinText(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "Text"); }
public WpfCheckbox(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Checkbox"); }
public WpfControl(DesktopContext context) : base(context, "UIA") { this.SearchProperties.Add(PropertyNames.FrameworkId, "WPF"); }
public WinMenuItem(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "MenuItem"); }
public WpfToolBar(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "ToolBar"); }
public WinGroup(DesktopContext context) : base(context) { this.SearchProperties.Add(new SearchProperty(WinControl.PropertyNames.ControlType, "Group")); }
public WpfImage(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Image"); }
public WinSplitButton(DesktopContext context) : base(context) { this.SearchProperties.Add(new SearchProperty(WinControl.PropertyNames.ControlType, "SplitButton")); }
public WpfSeparator(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "Separator"); }
public WpfTabPage(DesktopContext context) : base(context) { this.SearchProperties.Add(WpfControl.PropertyNames.ControlType, "TabPage"); }
public WinSlider(DesktopContext context) : base(context) { this.SearchProperties.Add(WinControl.PropertyNames.ControlType, "Slider"); }