本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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" }));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}