public void IsAValidApiRequestWithXmlAndType2()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "xml", "2");
            var t = new GeckoboardService(request, (a, b) => null, a => true);

            Assert.AreEqual(FixtureConstants.Authorization_Test123_Source, t.ApiKey);
            Assert.AreEqual(ResponseFormat.Xml, t.ResponseFormat);
            Assert.AreEqual(WidgetType.RagColumnAndNumbers, t.WidgetType);
        }
        public void IsAValidApiRequestWithJsonAndType4()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", "4");
            var t = new GeckoboardService(request, (a, b) => null, a => true);

            Assert.AreEqual(FixtureConstants.Authorization_Test123_Source, t.ApiKey);
            Assert.AreEqual(ResponseFormat.Json, t.ResponseFormat);
            Assert.AreEqual(WidgetType.Text, t.WidgetType);
        }
        public void ThrowBecauseInvalidApiKey()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", "4");
            var t = new GeckoboardService(request,
                (a, b) => new List<DataItemText> { new DataItemText { type = 1, text = "blah" } },
                a => a == "notavalidapikey" // <--
            );

            t.Result();
        }
        public void ApIKeyValidationOmittedShouldPass()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", "4");
            var t = new GeckoboardService(request,
                (a, b) => new List<DataItemText> { new DataItemText { type = 1, text = "blah" } },
                null // <--
            );

            t.Result();
        }
        private static JsonResult _CreateJsonResult(WidgetType widgetType, object data)
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", ((int)widgetType).ToString());
            var t       = new GeckoboardService(request,
                                                (a, b) => data,
                                                a => a == FixtureConstants.Authorization_Test123_Source
                                                );

            var res = t.Result() as JsonResult;

            Assert.IsNotNull(res);
            return(res);
        }
Beispiel #6
0
        public void ApIKeyValidationOmittedShouldPass()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", "4");
            var t       = new GeckoboardService(request,
                                                (a, b) => new List <DataItemText> {
                new DataItemText {
                    type = 1, text = "blah"
                }
            },
                                                null // <--
                                                );

            t.Result();
        }
Beispiel #7
0
        public void ThisIsAValidApiKey()
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", "4");
            var t       = new GeckoboardService(request,
                                                (a, b) => new List <DataItemText> {
                new DataItemText {
                    type = 1, text = "blah"
                }
            },
                                                a => a == FixtureConstants.Authorization_Test123_Source // <--
                                                );

            t.Result();
        }
        private static JsonResult _CreateJsonResult(WidgetType widgetType, object data)
        {
            var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "json", ((int)widgetType).ToString());
            var t = new GeckoboardService(request,
                (a, b) => data,
                a => a == FixtureConstants.Authorization_Test123_Source
            );

            var res = t.Result() as JsonResult;

            Assert.IsNotNull(res);
            return res;
        }
 public void ThrowBecauseOfOutOfRangeType()
 {
     var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "xml", "0");
     var t = new GeckoboardService(request, (a, b) => null, a => true);
 }
 public void ThrowBecauseOfOutOfRangeType()
 {
     var request = new HttpRequestBaseMock(FixtureConstants.Authorization_Test123, "xml", "0");
     var t       = new GeckoboardService(request, (a, b) => null, a => true);
 }