public void TestFilterClause_Eq_Title_Constant()
        {
            RESTUrlBuilder <ListItem> queryBuilder = new RESTUrlBuilder <ListItem>();
            string filterQuery = queryBuilder.BuildFilterClause(li => li.Title == "Test");

            Assert.AreEqual("Title eq 'Test'", filterQuery);
        }
        public void TestFilterClause_Eq_Id()
        {
            RESTUrlBuilder <ListItem> queryBuilder = new RESTUrlBuilder <ListItem>();
            string filterQuery = queryBuilder.BuildFilterClause(li => li.Id == 1);

            Assert.AreEqual("Id eq 1", filterQuery);
        }
        //[TestMethod]
        public void TestFilterClause()
        {
            RESTUrlBuilder <ListItem> queryBuilder = new RESTUrlBuilder <ListItem>();
            string filterQuery = queryBuilder.BuildFilterClause(li => li.Id == 1);

            SPOHttpClient spoClient             = new SPOHttpClient(login, password, site);
            CollectionResponse <ListItem> items = spoClient.GetData <CollectionResponse <ListItem> >("/_api/web/lists/getByTitle('Umowy')/items?$filter=" + filterQuery);
        }
        public void RESTUrlBuilder_Test_GetFilter_SimpleEquals_Int()
        {
            string expected = "Id eq 1";
            RESTUrlBuilder <MockEntity> builder = new RESTUrlBuilder <MockEntity>();
            string actual = builder.BuildFilterClause(m => m.Id == 1);

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetFilter_SimpleEquals_Text()
        {
            string expected = "Title eq 'Test'";
            RESTUrlBuilder <MockEntity> builder = new RESTUrlBuilder <MockEntity>();
            string actual = builder.BuildFilterClause(m => m.Title == "Test");

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetId_Int()
        {
            string expected = "http://mockurl/odata/MockSPEntities(1)";
            RESTUrlBuilder <MockEntity> builder = new RESTUrlBuilder <MockEntity>();
            string actual = builder.BuildIdQuery("http://mockurl/odata/MockSPEntities", 1);

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetSelect_Complex_WithList()
        {
            string expected = "ID,Name,Categories/ID,Categories/Name,Description,ReleaseDate";
            RESTUrlBuilder <Product> builder = new RESTUrlBuilder <Product>();
            string actual = builder.BuildSelect();

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetExpand_Complex()
        {
            string expected = "Categories";
            RESTUrlBuilder <Product> builder = new RESTUrlBuilder <Product>();
            string actual = builder.BuildExpand();

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetExpand_Simple()
        {
            string expected = "";
            RESTUrlBuilder <MockEntity> builder = new RESTUrlBuilder <MockEntity>();
            string actual = builder.BuildExpand();

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetSelect_Complex()
        {
            string expected = "Id,Title,Created,TestLookup/Id,TestLookup/Title";
            RESTUrlBuilder <MockSPEntity> builder = new RESTUrlBuilder <MockSPEntity>();
            string actual = builder.BuildSelect();

            Assert.AreEqual(expected, actual);
        }
        public void RESTUrlBuilder_Test_GetSelect_Simple()
        {
            string expected = "Id,Title";
            RESTUrlBuilder <MockEntity> builder = new RESTUrlBuilder <MockEntity>();
            string actual = builder.BuildSelect();

            Assert.AreEqual(expected, actual);
        }
        public void TestFilterClause_Eq_Title_Variable()
        {
            string title = "Test";
            RESTUrlBuilder <ListItem> queryBuilder = new RESTUrlBuilder <ListItem>();
            string filterQuery = queryBuilder.BuildFilterClause(li => li.Title == title);

            Assert.AreEqual("Title eq 'Test'", filterQuery);
        }