本文整理汇总了C#中ServiceCollection.Last方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceCollection.Last方法的具体用法?C# ServiceCollection.Last怎么用?C# ServiceCollection.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceCollection
的用法示例。
在下文中一共展示了ServiceCollection.Last方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefinitionPassbookContainsService
public void DefinitionPassbookContainsService()
{
ServiceCollection services = new ServiceCollection();
DefinitionTests.DefinePassbook(services);
Assert.AreEqual(1, services.Count);
Assert.IsNotNull(services.CurrentService);
Assert.AreEqual(services.Last(), services.CurrentService);
Assert.AreEqual("Passbook", services.CurrentService.Name);
}
示例2: DefinitionPassbookContainsGetLatestVersionOfPassEndpointAndMethods
public void DefinitionPassbookContainsGetLatestVersionOfPassEndpointAndMethods()
{
ServiceCollection services = new ServiceCollection();
DefinitionTests.DefinePassbook(services);
EndpointCollection endpoints = services.Last().Endpoints as EndpointCollection;
Assert.IsNotNull(endpoints);
Assert.IsTrue(endpoints.Any());
Assert.AreEqual("v1/passes/{passTypeIdentifier}/{serialNumber}", endpoints.First().Route.ToString());
MethodCollection methods = endpoints.First().Methods as MethodCollection;
Assert.IsNotNull(methods);
Assert.AreEqual(1, methods.Count());
Assert.AreEqual(MethodType.Get, methods.First().MethodType);
}
示例3: DefinitionPassbookContainsDeviceUnregistrationEndpointAndMethods
public void DefinitionPassbookContainsDeviceUnregistrationEndpointAndMethods()
{
ServiceCollection services = new ServiceCollection();
DefinitionTests.DefinePassbook(services);
EndpointCollection endpoints = services.Last().Endpoints as EndpointCollection;
Assert.IsNotNull(endpoints);
Assert.IsTrue(3 <= endpoints.Count());
Assert.AreEqual("v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}/{serialNumber}", endpoints.ElementAt(2).Route.ToString());
MethodCollection methods = endpoints.ElementAt(2).Methods as MethodCollection;
Assert.IsNotNull(methods);
Assert.AreEqual(1, methods.Count());
Assert.AreEqual(MethodType.Delete, methods.First().MethodType);
}