當前位置: 首頁>>代碼示例>>C#>>正文


C# Stubs.StubIntegrationProxy類代碼示例

本文整理匯總了C#中XeroApi.Tests.Stubs.StubIntegrationProxy的典型用法代碼示例。如果您正苦於以下問題:C# StubIntegrationProxy類的具體用法?C# StubIntegrationProxy怎麽用?C# StubIntegrationProxy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StubIntegrationProxy類屬於XeroApi.Tests.Stubs命名空間,在下文中一共展示了StubIntegrationProxy類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: it_can_parse_implicit_boolean_where_filter

        public void it_can_parse_implicit_boolean_where_filter()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var users = repository.Users.Where(user => user.IsSubscriber).ToList();

            Assert.AreEqual("(IsSubscriber == true)", integrationProxy.LastQueryDescription.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:9,代碼來源:ApiQueryTests.cs

示例2: it_can_UpdateOrCreate_a_model_that_represents_a_valid_endpoint

        public void it_can_UpdateOrCreate_a_model_that_represents_a_valid_endpoint()
        {
            var integrationProxy = new Stubs.StubIntegrationProxy();

            Repository repository = new Repository(integrationProxy);

            repository.UpdateOrCreate(new Invoice());

            Assert.AreEqual("Invoice", integrationProxy.LastEndpointName);
        }
開發者ID:narent,項目名稱:XeroAPI.Net,代碼行數:10,代碼來源:RepositoryTests.cs

示例3: TestApiQueryCanCallOrganisationsEndpointWithNoArguments

        public void TestApiQueryCanCallOrganisationsEndpointWithNoArguments()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            List<Organisation> organisations = repository.Organisations.ToList();

            Assert.AreEqual(0, organisations.Count);
            Assert.AreEqual("Organisation", integrationProxy.LastQueryDescription.ElementName);
        }
開發者ID:sgtfsu,項目名稱:XeroAPI.Net,代碼行數:10,代碼來源:ApiQueryTests.cs

示例4: TestApiQueryCanCallInvoicesEndpointWithContactNumberFilter

        public void TestApiQueryCanCallInvoicesEndpointWithContactNumberFilter()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var invoices = repository.Invoices.Where(inv => inv.Contact.ContactNumber == "S0029").ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("Invoice", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Contact.ContactNumber == \"S0029\")", queryDesctipion.Where);
            Assert.AreEqual("", queryDesctipion.Order);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:12,代碼來源:ApiQueryTests.cs

示例5: TestApiQueryCanCallOrganisationsEndpointWithOneWhereArgument

        public void TestApiQueryCanCallOrganisationsEndpointWithOneWhereArgument()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var organisations = repository.Organisations.Where(o => o.Name == "Demo Company (NZ)").ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("Organisation", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Name == \"Demo Company (NZ)\")", queryDesctipion.Where);
            Assert.AreEqual("", queryDesctipion.Order);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:12,代碼來源:ApiQueryTests.cs

示例6: TestApiQueryCanCallUsersEndpointWith_implicit_BooleanFilter

        public void TestApiQueryCanCallUsersEndpointWith_implicit_BooleanFilter()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            // Note: This needs the '== true' but to work correctly
            List<User> invoices = repository.Users.Where(user => user.IsSubscriber).ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("User", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(IsSubscriber == true)", queryDesctipion.Where);
            Assert.AreEqual("", queryDesctipion.Order);
            Assert.AreEqual(0, invoices.Count);
        }
開發者ID:sgtfsu,項目名稱:XeroAPI.Net,代碼行數:14,代碼來源:ApiQueryTests.cs

示例7: TestApiQueryCanCallOrganisationsEndpointWithTwoWhereArguments

        public void TestApiQueryCanCallOrganisationsEndpointWithTwoWhereArguments()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var response = repository.Organisations
                .Where(o => o.Name == "Demo Company")
                .Where(o => o.APIKey == "ABCDEFG")
                .ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("Organisation", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Name == \"Demo Company\") AND (APIKey == \"ABCDEFG\")", queryDesctipion.Where);
            Assert.AreEqual("", queryDesctipion.Order);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:15,代碼來源:ApiQueryTests.cs

示例8: it_can_filter_string_properties_using_startswith_method_with_another_filter

        public void it_can_filter_string_properties_using_startswith_method_with_another_filter()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var response = repository.Contacts.FirstOrDefault(c => c.Name.StartsWith("Coffee") && c.IsCustomer == true);

            var queryDesctipion = integrationProxy.LastQueryDescription;

            Assert.AreEqual("Contact", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Name.StartsWith(\"Coffee\") AND (IsCustomer == true))", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:12,代碼來源:ApiQueryTests.cs

示例9: it_does_not_implement_contains_linq_method

        public void it_does_not_implement_contains_linq_method()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            Assert.Throws<NotImplementedException>(() => repository.Contacts.Contains(new Contact { Name = "Jason" }));
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:7,代碼來源:ApiQueryTests.cs

示例10: it_can_filter_string_properties_on_methos_of_literal

        public void it_can_filter_string_properties_on_methos_of_literal()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            repository.Contacts.FirstOrDefault(c => c.Name == "Jason".ToUpper());
            var queryDesctipion = integrationProxy.LastQueryDescription;

            Assert.AreEqual("Contact", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Name == \"JASON\")", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:11,代碼來源:ApiQueryTests.cs

示例11: it_can_filter_string_properties_using_contains_method

        public void it_can_filter_string_properties_using_contains_method()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            repository.Contacts.FirstOrDefault(c => c.Name.Contains("Coffee"));
            var queryDesctipion = integrationProxy.LastQueryDescription;

            Assert.AreEqual("Contact", queryDesctipion.ElementType.Name);
            Assert.AreEqual("Name.Contains(\"Coffee\")", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:11,代碼來源:ApiQueryTests.cs

示例12: it_can_filter_properties_on_object_properties_not_in_the_linq_definition

        public void it_can_filter_properties_on_object_properties_not_in_the_linq_definition()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var invoice = new Invoice {Contact = new Contact { Name = "Joe Bloggs" }};

            var response = repository.Invoices
                .Where(i => i.Contact.Name == invoice.Contact.Name)
                .ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("Invoice", queryDesctipion.ElementType.Name);
            Assert.AreEqual("(Contact.Name == \"Joe Bloggs\")", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:15,代碼來源:ApiQueryTests.cs

示例13: TestApiQueryCanCallContactsEndpointWithContactNumberIsNotNull

        public void TestApiQueryCanCallContactsEndpointWithContactNumberIsNotNull()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var response = repository.Contacts.SingleOrDefault(i => i.ContactNumber != null);

            var queryDesctipion = integrationProxy.LastQueryDescription;

            Assert.AreEqual("Contact", queryDesctipion.ElementType.Name);
            Assert.AreEqual("SingleOrDefault", queryDesctipion.ClientSideExpression);
            Assert.AreEqual("(ContactNumber <> NULL)", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:13,代碼來源:ApiQueryTests.cs

示例14: it_can_filter_using_a_predefined_predicate_expression_variable

        public void it_can_filter_using_a_predefined_predicate_expression_variable()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            Expression<Func<Invoice, bool>> filterInvoiceByCurrency = i => i.CurrencyCode == "AUD";

            var response = repository.Invoices.Where(filterInvoiceByCurrency).ToList();
            
            Assert.AreEqual("(CurrencyCode == \"AUD\")", integrationProxy.LastQueryDescription.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:11,代碼來源:ApiQueryTests.cs

示例15: TestApiQueryCanCallContactsEndpointWithAndAlsoOperator

        public void TestApiQueryCanCallContactsEndpointWithAndAlsoOperator()
        {
            StubIntegrationProxy integrationProxy = new StubIntegrationProxy();
            Repository repository = new Repository(integrationProxy);

            var response = repository.Contacts
                .Where(c => c.ContactStatus == "ACTIVE" && c.IsCustomer == true)
                .ToList();

            var queryDesctipion = integrationProxy.LastQueryDescription;
            Assert.AreEqual("Contact", queryDesctipion.ElementType.Name);
            Assert.AreEqual("((ContactStatus == \"ACTIVE\") AND (IsCustomer == true))", queryDesctipion.Where);
        }
開發者ID:Bitwix,項目名稱:XeroAPI.Net,代碼行數:13,代碼來源:ApiQueryTests.cs


注:本文中的XeroApi.Tests.Stubs.StubIntegrationProxy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。