本文整理汇总了C#中AllReady.Controllers.EventApiController.GetAttributesOn方法的典型用法代码示例。如果您正苦于以下问题:C# EventApiController.GetAttributesOn方法的具体用法?C# EventApiController.GetAttributesOn怎么用?C# EventApiController.GetAttributesOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllReady.Controllers.EventApiController
的用法示例。
在下文中一共展示了EventApiController.GetAttributesOn方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetByIdHasProducesAttributeWithCorrectContentTypes
public void GetByIdHasProducesAttributeWithCorrectContentTypes()
{
var sut = new EventApiController(null, null);
var attribute = sut.GetAttributesOn(x => x.Get(It.IsAny<int>())).OfType<ProducesAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Type, typeof(EventViewModel));
Assert.Equal(attribute.ContentTypes.Select(x => x).First(), "application/json");
}
示例2: UnregisterEventHasAuthorizeAttribute
public void UnregisterEventHasAuthorizeAttribute()
{
var sut = new EventApiController(null, null);
var attribute = (AuthorizeAttribute)sut.GetAttributesOn(x => x.UnregisterEvent(It.IsAny<int>())).SingleOrDefault(x => x.GetType() == typeof(AuthorizeAttribute));
Assert.NotNull(attribute);
}
示例3: GetByIdHasHttpGetAttributeWithCorrectTemplate
public void GetByIdHasHttpGetAttributeWithCorrectTemplate()
{
var sut = new EventApiController(null, null);
var attribute = sut.GetAttributesOn(x => x.Get(It.IsAny<int>())).OfType<HttpGetAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "{id}");
}
示例4: GetHasHttpGetAttribute
public void GetHasHttpGetAttribute()
{
var sut = new EventApiController(null, null);
var attribute = sut.GetAttributesOn(x => x.Get()).OfType<HttpGetAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
}
示例5: UnregisterEventHasHttpDeleteAttributeWithCorrectTemplate
public void UnregisterEventHasHttpDeleteAttributeWithCorrectTemplate()
{
var sut = new EventApiController(null, null);
var attribute = (HttpDeleteAttribute)sut.GetAttributesOn(x => x.UnregisterEvent(It.IsAny<int>())).SingleOrDefault(x => x.GetType() == typeof(HttpDeleteAttribute));
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "{id}/signup");
}
示例6: RegisterEventHasValidateAntiForgeryTokenAttribute
public void RegisterEventHasValidateAntiForgeryTokenAttribute()
{
var sut = new EventApiController(null, null);
var attribute = (ValidateAntiForgeryTokenAttribute)sut.GetAttributesOn(x => x.RegisterEvent(It.IsAny<EventSignupViewModel>())).SingleOrDefault(x => x.GetType() == typeof(ValidateAntiForgeryTokenAttribute));
Assert.NotNull(attribute);
}
示例7: RegisterEventHasHttpPostAttributeWithCorrectTemplate
public void RegisterEventHasHttpPostAttributeWithCorrectTemplate()
{
var sut = new EventApiController(null, null);
var attribute = (HttpPostAttribute)sut.GetAttributesOn(x => x.RegisterEvent(It.IsAny<EventSignupViewModel>())).SingleOrDefault(x => x.GetType() == typeof(HttpPostAttribute));
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "signup");
}
示例8: PutCheckinHasHttpPutAttributeWithCorrectTemplate
public void PutCheckinHasHttpPutAttributeWithCorrectTemplate()
{
var sut = new EventApiController(null, null);
var attribute = (HttpPutAttribute)sut.GetAttributesOn(x => x.PutCheckin(It.IsAny<int>())).SingleOrDefault(x => x.GetType() == typeof(HttpPutAttribute));
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "{id}/checkin");
}
示例9: GetEventsByLocationHasRouteAttributeWithCorrectRoute
public void GetEventsByLocationHasRouteAttributeWithCorrectRoute()
{
var sut = new EventApiController(null, null);
var attribute = sut.GetAttributesOn(x => x.GetEventsByGeography(It.IsAny<double>(), It.IsAny<double>(), It.IsAny<int>())).OfType<RouteAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "searchbylocation");
}
示例10: GetEventsByPostalCodeHasRouteAttributeWithRoute
public void GetEventsByPostalCodeHasRouteAttributeWithRoute()
{
var sut = new EventApiController(null, null);
var attribute = sut.GetAttributesOn(x => x.GetEventsByPostalCode(It.IsAny<string>(), It.IsAny<int>())).OfType<RouteAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "search");
}
示例11: GetEventsByDateRangeHasProducesAttribute
public void GetEventsByDateRangeHasProducesAttribute()
{
var sut = new EventApiController(null);
var attribute = sut.GetAttributesOn(x => x.GetEventsByDateRange(It.IsAny<DateTimeOffset>(), It.IsAny<DateTimeOffset>())).OfType<ProducesAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.ContentTypes[0], "application/json");
Assert.Equal(attribute.Type, typeof(EventViewModel));
}
示例12: GetEventsByDateRangeHasHttpGetAttributeWithCorrectTemplate
public void GetEventsByDateRangeHasHttpGetAttributeWithCorrectTemplate()
{
var sut = new EventApiController(null);
var attribute = sut.GetAttributesOn(x => x.GetEventsByDateRange(It.IsAny<DateTimeOffset>(), It.IsAny<DateTimeOffset>())).OfType<HttpGetAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Template, "{start}/{end}");
}