本文整理汇总了C#中ServiceController.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceController.Execute方法的具体用法?C# ServiceController.Execute怎么用?C# ServiceController.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceController
的用法示例。
在下文中一共展示了ServiceController.Execute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_execute_BasicService
public void Can_execute_BasicService()
{
var serviceController = new ServiceController();
serviceController.Register(() => new BasicService());
var result = serviceController.Execute(new BasicRequest()) as BasicRequestResponse;
Assert.That(result, Is.Not.Null);
}
示例2: With_Expressions
public void With_Expressions()
{
var requestType = typeof(BasicRequest);
var serviceController = new ServiceController();
serviceController.Register(requestType, typeof(BasicService));
var request = new BasicRequest();
Console.WriteLine("With_Expressions(): {0}", Measure(() => serviceController.Execute(request), Times));
}
示例3: Can_execute_RestTestService
public void Can_execute_RestTestService()
{
var serviceController = new ServiceController();
serviceController.Register(() => new RestTestService());
var result = serviceController.Execute(new RestTest()) as RestTestResponse;
Assert.That(result, Is.Not.Null);
Assert.That(result.MethodName, Is.EqualTo("Execute"));
}
示例4: NativeFunq_Perf
public void NativeFunq_Perf()
{
var serviceController = new ServiceController();
RegisterServices(serviceController, GetNativeFunqTypeFactory());
StoreAndGetCustomers(serviceController);
var request = new GetCustomer { CustomerId = 2 };
Console.WriteLine("NativeFunq_Perf(): {0}", Measure(() => serviceController.Execute(request), Times));
}
示例5: Can_execute_BasicService_from_dynamic_Type
public void Can_execute_BasicService_from_dynamic_Type()
{
var requestType = typeof(BasicRequest);
var serviceController = new ServiceController();
serviceController.Register(requestType, typeof(BasicService));
object request = Activator.CreateInstance(requestType);
var result = serviceController.Execute(request) as BasicRequestResponse;
Assert.That(result, Is.Not.Null);
}
示例6: StoreAndGetCustomers
private static void StoreAndGetCustomers(ServiceController serviceController)
{
var storeCustomers = new StoreCustomers {
Customers = {
new Customer { Id = 1, FirstName = "First", LastName = "Customer" },
new Customer { Id = 2, FirstName = "Second", LastName = "Customer" },
}
};
serviceController.Execute(storeCustomers);
storeCustomers = new StoreCustomers {
Customers = {
new Customer {Id = 3, FirstName = "Third", LastName = "Customer"},
}
};
serviceController.Execute(storeCustomers);
var response = serviceController.Execute(new GetCustomer { CustomerId = 2 });
Assert.That(response as GetCustomerResponse, Is.Not.Null);
var customer = ((GetCustomerResponse)response).Customer;
Assert.That(customer.FirstName, Is.EqualTo("Second"));
}
示例7: Can_RestTestService_DELETE
public void Can_RestTestService_DELETE()
{
var serviceController = new ServiceController();
serviceController.Register(() => new RestTestService());
var result = serviceController.Execute(new RestTest(),
new HttpRequestContext((object)null, EndpointAttributes.HttpDelete)) as RestTestResponse;
Assert.That(result, Is.Not.Null);
Assert.That(result.MethodName, Is.EqualTo("Delete"));
}
示例8: With_TypedArguments
public void With_TypedArguments()
{
var serviceController = new ServiceController();
serviceController.Register(() => new BasicService());
var request = new BasicRequest();
Console.WriteLine("With_TypedArguments(): {0}", Measure(() => serviceController.Execute(request), Times));
}