Ejemplo n.º 1
0
        public void CountTest()
        {
            const Boolean EXPECTED = true;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Count();

            Boolean actual = target.IsAggregationFunctionCount;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 2
0
        public void ConstructQueryFiltersTest()
        {
            const String KEY1 = "key1";
            const String VALUE1_A = "value1a";
            const String VALUE1_B = "value1b";
            const String VALUE1_C = "value1c";
            const String KEY2 = "key2";
            const Byte LOWER_BOUND_VALUE2 = 1;
            const Byte UPPER_BOUND_VALUE2 = 3;
            const String KEY3 = "key3";
            const String VALUE3 = "value3";
            const String KEY4 = "key4";
            const String VALUE4 = "value4";

            const String EXPECTED_KEY_EXISTS_VALUE = ":key1=*";
            const String EXPECTED_VALUE1 = ":key1=value1a,value1b,value1c";
            const String EXPECTED_VALUE2 = ":key2=1..3";
            const String EXPECTED_VALUE3 = ":key3=value3";
            const String EXPECTED_VALUE4 = ":key4=!value4";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED_KEY_EXISTS_VALUE);
            expected.Add(EXPECTED_VALUE1);
            expected.Add(EXPECTED_VALUE2);
            expected.Add(EXPECTED_VALUE3);
            expected.Add(EXPECTED_VALUE4);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.Where(KEY1.KeyExists()
                             .And(KEY1.IsEqualTo(VALUE1_A)
                                             .Or(VALUE1_B)
                                             .Or(VALUE1_C))
                             .And(KEY2.IsBetween(LOWER_BOUND_VALUE2, UPPER_BOUND_VALUE2))
                             .And(KEY3.IsEqualTo(VALUE3))
                             .And(KEY4.IsNotEqualTo(VALUE4)));

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructQueryFilters");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
            Assert.AreEqual(expected[4], actual[4]);
        }
Ejemplo n.º 3
0
        public void AlwaysReturn200InterfaceTest()
        {
            const Boolean EXPECTED = true;

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.AlwaysReturn200();

            Boolean actual = target.Is200AlwaysReturned;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 4
0
        public void ConstructIncludedSpecialSystemFieldsTestPath()
        {
            const StretchrSpecialSystemField PATH_SPECIAL_SYSTEM_FIELD = StretchrSpecialSystemField.Path;

            const String EXPECTED = "include=~path";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.IncludeSpecialSystemFields(PATH_SPECIAL_SYSTEM_FIELD);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructIncludedSpecialSystemFields");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 5
0
        public void ConstructMethodTestNone()
        {
            const Int32 EXPECTED_COUNT = 0;

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructMethod");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(EXPECTED_COUNT, actual.Count);
        }
Ejemplo n.º 6
0
        public void ClientTest()
        {
            Type expected = typeof(StretchrClient);

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            IStretchrClient actual = target.Client;

            Assert.IsInstanceOfType(actual, expected);
        }
Ejemplo n.º 7
0
        public void ConstructAuthenticationKeyTest()
        {
            const String AUTHENTICATION_KEY = "test";

            const String EXPECTED = "key=test";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.AuthNKey(AUTHENTICATION_KEY);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructAuthenticationKey");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 8
0
        public void IncludeTotalTest()
        {
            const Boolean EXPECTED = true;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.IncludeTotal();

            Boolean actual = target.IsTotalsIncluded;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 9
0
        public void OrderTest()
        {
            const String KEY1 = "-key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "-key4";

            IList<String> expected = new List<String>();
            expected.Add(KEY1);
            expected.Add(KEY2);
            expected.Add(KEY3);
            expected.Add(KEY4);

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Order("key1".SortDescending(), "key2".SortAscending(), "key3".SortAscending(), "key4".SortDescending());

            IList<String> actual = target.QueryOrderFunctionParameterList;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
        }
Ejemplo n.º 10
0
        public void IncludeAllVersionsInterfaceTest()
        {
            const Boolean EXPECTED = true;

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.IncludeAllVersions();

            Boolean actual = target.IsAllVersionsIncluded;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 11
0
        public void IncludeSpecialSystemFieldsTest()
        {
            const StretchrSpecialSystemField EXPECTED_PARENT = StretchrSpecialSystemField.Parent;
            const StretchrSpecialSystemField EXPECTED_PATH = StretchrSpecialSystemField.Path;

            IList<StretchrSpecialSystemField> expected = new List<StretchrSpecialSystemField>();
            expected.Add(EXPECTED_PARENT);
            expected.Add(EXPECTED_PATH);

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.IncludeSpecialSystemFields(EXPECTED_PARENT, EXPECTED_PATH);

            IList<StretchrSpecialSystemField> actual = target.SpecialSystemFieldList;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
        }
Ejemplo n.º 12
0
        public void HttpMethodTest()
        {
            System.Net.Http.HttpMethod expected = System.Net.Http.HttpMethod.Delete;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            System.Net.Http.HttpMethod actual = target.HttpMethod;

            Assert.AreEqual(actual, expected);
        }
Ejemplo n.º 13
0
        public void AtInterfaceTest()
        {
            const String EXPECTED = "test";

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.At("test/");

            String actual = target.Path;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 14
0
        public void ExcludeInterfaceTest()
        {
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";

            IList<String> expected = new List<String>();
            expected.Add(KEY1);
            expected.Add(KEY2);
            expected.Add(KEY3);
            expected.Add(KEY4);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Exclude(KEY1, KEY2, KEY3, KEY4);

            IList<String> actual = target.ExcludedFieldList;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
        }
Ejemplo n.º 15
0
        public void WhereTest()
        {
            const String KEY1 = "key1";
            const String VALUE1_A = "value1a";
            const String VALUE1_B = "value1b";
            const String VALUE1_C = "value1c";
            const String KEY2 = "key2";
            const Byte LOWER_BOUND_VALUE2 = 1;
            const Byte UPPER_BOUND_VALUE2 = 3;
            const String KEY3 = "key3";
            const String VALUE3 = "value3";
            const String KEY4 = "key4";
            const String VALUE4 = "value4";

            const String EXPECTED_KEY_EXISTS_VALUE = "*";
            const String EXPECTED_VALUE1 = "value1a,value1b,value1c";
            const String EXPECTED_VALUE2 = "1..3";
            const String EXPECTED_VALUE3 = VALUE3;
            const String EXPECTED_VALUE4 = "!value4";

            IList<KeyValuePair<String, String>> expected = new List<KeyValuePair<String, String>>();
            expected.Add(new KeyValuePair<String, String>(KEY1, EXPECTED_KEY_EXISTS_VALUE));
            expected.Add(new KeyValuePair<String, String>(KEY1, EXPECTED_VALUE1));
            expected.Add(new KeyValuePair<String, String>(KEY2, EXPECTED_VALUE2));
            expected.Add(new KeyValuePair<String, String>(KEY3, EXPECTED_VALUE3));
            expected.Add(new KeyValuePair<String, String>(KEY4, EXPECTED_VALUE4));

            StretchrRequest<String> stretchrQuery = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            IList<KeyValuePair<String, String>> actual =
                stretchrQuery.Where(KEY1.KeyExists()
                                        .And(KEY1.IsEqualTo(VALUE1_A)
                                                        .Or(VALUE1_B)
                                                        .Or(VALUE1_C))
                                        .And(KEY2.IsBetween(LOWER_BOUND_VALUE2, UPPER_BOUND_VALUE2))
                                        .And(KEY3.IsEqualTo(VALUE3))
                                        .And(KEY4.IsNotEqualTo(VALUE4))).FilterParameterList;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
            Assert.AreEqual(expected[4], actual[4]);
        }
Ejemplo n.º 16
0
        public void QueryStringTest()
        {
            const String AUTHENTICATION_KEY = "645643654563456";
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";
            const String KEY5 = "key5";
            const String KEY_AGE = "Age";
            const String KEY_GENDER = "Gender";
            const String KEY_NAME = "Name";
            const String KEY_PROFESSION = "Profession";
            const String PATH = "/test/path";

            const String EXPECTED = "key=645643654563456&method=GET&always200=1&exclude=key1,key2,key3&include=~parent,~path&total=1&:Name=*&:Name=John,Tyler,Ryan&:Age=18..65&:Profession=Software Engineer&:Gender=!Female&avg(key4,key5)&count()&group(key4,key5)&max(key4,key5)&min(key4,key5)&sum(key4,key5)&uniqueSet(key4,key5)&unwind(key4,key5)&~order=key4,-key5&limit=10&skip=10&versioning=1";

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.AuthNKey(AUTHENTICATION_KEY)
                  .UseHttpMethod(System.Net.Http.HttpMethod.Get)
                  .AlwaysReturn200()
                  .At(PATH)
                  .Exclude(KEY1, KEY2, KEY3)
                  .IncludeAllVersions()
                  .IncludeSpecialSystemFields(StretchrSpecialSystemField.Parent,
                                              StretchrSpecialSystemField.Path)
                  .IncludeTotal()
                  .Where(KEY_NAME.KeyExists()
                                 .And(KEY_NAME.IsEqualTo("John")
                                                     .Or("Tyler")
                                                     .Or("Ryan"))
                                 .And(KEY_AGE.IsBetween(18, 65))
                                 .And(KEY_PROFESSION.IsEqualTo("Software Engineer"))
                                 .And(KEY_GENDER.IsNotEqualTo("Female")))
                  .Average(KEY4, KEY5)
                  .Count()
                  .Group(KEY4, KEY5)
                  .Max(KEY4, KEY5)
                  .Min(KEY4, KEY5)
                  .Sum(KEY4, KEY5)
                  .UniqueSet(KEY4, KEY5)
                  .Unwind(KEY4, KEY5)
                  .Order(KEY4.SortAscending(), KEY5.SortDescending())
                  .Limit(10)
                  .Skip(10)
                  .UseVersioning();

            String actual = target.QueryString;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 17
0
        public void AverageTest()
        {
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";

            IList<String> expected = new List<String>();
            expected.Add(KEY1);
            expected.Add(KEY2);
            expected.Add(KEY3);
            expected.Add(KEY4);

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Average(KEY1, KEY2, KEY3, KEY4);

            IList<String> actual = target.AggregationFunctionParameterListAverage;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
        }
Ejemplo n.º 18
0
        public void QueryStringTestNone()
        {
            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            String actual = target.QueryString;

            Assert.IsNull(actual);
        }
Ejemplo n.º 19
0
        public void ConstructAggregationFunctionsTest()
        {
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";

            const String EXPECTED_AVERAGE = "avg(key1)";
            const String EXPECTED_COUNT = "count()";
            const String EXPECTED_GROUP = "group(key1,key2,key3)";
            const String EXPECTED_MAX = "max(key1,key2)";
            const String EXPECTED_MIN = "min(key1)";
            const String EXPECTED_SUM = "sum(key1,key2,key3)";
            const String EXPECTED_UNIQUE_SET = "uniqueSet(key1,key2)";
            const String EXPECTED_UNWIND = "unwind(key1,key2,key3,key4)";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED_AVERAGE);
            expected.Add(EXPECTED_COUNT);
            expected.Add(EXPECTED_GROUP);
            expected.Add(EXPECTED_MAX);
            expected.Add(EXPECTED_MIN);
            expected.Add(EXPECTED_SUM);
            expected.Add(EXPECTED_UNIQUE_SET);
            expected.Add(EXPECTED_UNWIND);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.Average(KEY1)
                  .Count()
                  .Group(KEY1, KEY2, KEY3)
                  .Max(KEY1, KEY2)
                  .Min(KEY1)
                  .Sum(KEY1, KEY2, KEY3)
                  .UniqueSet(KEY1, KEY2)
                  .Unwind(KEY1, KEY2, KEY3, KEY4);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructAggregationFunctions");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
            Assert.AreEqual(expected[4], actual[4]);
            Assert.AreEqual(expected[5], actual[5]);
            Assert.AreEqual(expected[6], actual[6]);
            Assert.AreEqual(expected[7], actual[7]);
        }
Ejemplo n.º 20
0
        public void AuthNKeyTest()
        {
            const String EXPECTED = "test";

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.AuthNKey("test");

            String actual = target.AuthenticationKey;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 21
0
        public void ConstructExcludedFieldsTest()
        {
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";

            const String EXPECTED = "exclude=key1,key2,key3,key4";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.Exclude(KEY1, KEY2, KEY3, KEY4);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructExcludedFields");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 22
0
        public void SkipTest()
        {
            const Int32 EXPECTED = 10;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Skip(EXPECTED);

            Int32 actual = target.QueryPagingFunctionParameterSkip;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 23
0
        public void ConstructIncludeTotalsTest()
        {
            const String EXPECTED = "total=1";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.IncludeTotal();

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructIncludeTotals");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 24
0
        public void StretchrRequestConstructorTest()
        {
            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            Assert.IsInstanceOfType(target, typeof(StretchrRequest<String>));
        }
Ejemplo n.º 25
0
        public void ConstructMethodTestPut()
        {
            const String EXPECTED = "method=PUT";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.UseHttpMethod(System.Net.Http.HttpMethod.Put);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructMethod");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 26
0
        public void UseHttpMethodTest()
        {
            System.Net.Http.HttpMethod expectedHttpMethod = System.Net.Http.HttpMethod.Get;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.UseHttpMethod(expectedHttpMethod);

            System.Net.Http.HttpMethod actual = target.HttpMethodOverride;

            Assert.AreEqual(expectedHttpMethod, actual);
        }
Ejemplo n.º 27
0
        public void ConstructQueryFiltersTestNone()
        {
            IList<String> expected = new List<String>();

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructQueryFilters");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
        }
Ejemplo n.º 28
0
        public void UseVersioningTest()
        {
            const Boolean EXPECTED = true;

            StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.UseVersioning();

            Boolean actual = target.IsVersioningUsed;

            Assert.AreEqual(EXPECTED, actual);
        }
Ejemplo n.º 29
0
        public void ConstructQueryOrderFunctionTest()
        {
            const String KEY1 = "key1";
            const String KEY2 = "key2";
            const String KEY3 = "key3";
            const String KEY4 = "key4";

            const String EXPECTED = "~order=key1,-key2,-key3,key4";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });

            target.Order(KEY1.SortAscending(), KEY2.SortDescending(), KEY3.SortDescending(), KEY4.SortAscending());

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructQueryOrderFunction");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 30
0
        public void ConstructQueryPaginationTestSkip()
        {
            const Int32 PAGINATION_SKIP = 20;

            IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { });
            target.Skip(PAGINATION_SKIP);

            const String EXPECTED = "skip=20";

            IList<String> expected = new List<String>();
            expected.Add(EXPECTED);

            PrivateObject privateTarget = new PrivateObject(target);

            privateTarget.Invoke("ConstructQueryPagination");

            IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList");

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected[0], actual[0]);
        }