コード例 #1
0
        public void Live_Push_BarChart()
        {
            // Arrange
            var widgetKey = BARCHART_WIDGETKEY;        // replace this value with your own
            var obj       = new GeckoBarChart()
            {
                XAxis = new GeckoBarChartXAxis()
                {
                    Labels = new List <string> {
                        "2000", "2001", "2002", "2003", "2004", "2005"
                    }
                },
                YAxis = new GeckoBarChartYAxis()
                {
                    Format = "currency",
                    Unit   = "USD"
                },
                Series = new List <GeckoBarChartSeries>()
                {
                    new GeckoBarChartSeries()
                    {
                        Data = new List <int> {
                            1000, 1500, 30600, 28800, 22300, 36900
                        }
                    }
                }
            };

            var push = new PushPayload <GeckoBarChart>()
            {
                ApiKey = _apiKey,
                Data   = obj
            };
            var client = new GeckoConnect();
            var json   = JsonConvert.SerializeObject(push, Formatting.Indented); // Just for curiosity sake

            // Act
            Assert.AreNotEqual("<api key here>", _apiKey);
            Assert.AreNotEqual("<widget key here>", widgetKey);
            var result = client.Push <GeckoBarChart>(push, widgetKey);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.IsTrue(string.IsNullOrWhiteSpace(result.Message));
        }
コード例 #2
0
ファイル: PushTests.cs プロジェクト: kfrancis/geckonet
        public void Live_Push_BarChart()
        {
            // Arrange
            var widgetKey = "<widget key here>";        // replace this value with your own
            var obj = new GeckoBarChart()
            {
                XAxis = new GeckoBarChartXAxis()
                {
                    Labels = new List<string> { "2000", "2001", "2002", "2003", "2004", "2005" }
                },
                YAxis = new GeckoBarChartYAxis()
                {
                    Format = "currency",
                    Unit = "USD"
                },
                Series = new List<GeckoBarChartSeries>()
                {
                    new GeckoBarChartSeries(){
                        Data = new List<int>{ 1000, 1500, 30600, 28800, 22300, 36900 }
                    }
                }
            };

            var push = new PushPayload<GeckoBarChart>()
            {
                ApiKey = this.apiKey,
                Data = obj
            };
            var client = new GeckoConnect();
            var json = JsonConvert.SerializeObject(push, Formatting.Indented);  // Just for curiosity sake

            // Act
            Assert.AreNotEqual("<api key here>", this.apiKey);
            Assert.AreNotEqual("<widget key here>", widgetKey);
            var result = client.Push<GeckoBarChart>(push, widgetKey);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.IsTrue(string.IsNullOrWhiteSpace(result.Message));
        }