本文整理汇总了C#中TestODataMetadataLevel类的典型用法代码示例。如果您正苦于以下问题:C# TestODataMetadataLevel类的具体用法?C# TestODataMetadataLevel怎么用?C# TestODataMetadataLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestODataMetadataLevel类属于命名空间,在下文中一共展示了TestODataMetadataLevel类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ShouldSuppressTypeNameSerialization
public void ShouldSuppressTypeNameSerialization(TestODataMetadataLevel metadataLevel, bool expectedResult)
{
// Act
bool actualResult = ODataComplexTypeSerializer.ShouldSuppressTypeNameSerialization(
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataComplexTypeSerializerTests.cs
示例2: CreateODataAction_OmitsAction_WhenFollowingConventions
public void CreateODataAction_OmitsAction_WhenFollowingConventions(TestODataMetadataLevel metadataLevel)
{
// Arrange
IEdmAction action = CreateFakeAction("IgnoreAction", isBindable: true);
ActionLinkBuilder linkBuilder = new ActionLinkBuilder((a) => new Uri("aa://Ignore"),
followsConventions: true);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetActionLinkBuilder(action, linkBuilder);
IEdmModel model = CreateFakeModel(annotationsManager);
UrlHelper url = CreateMetadataLinkFactory("http://IgnoreMetadataPath");
EntityInstanceContext context = CreateContext(model, url);
context.SerializerContext.MetadataLevel = (ODataMetadataLevel)metadataLevel;
// Act
ODataAction actualAction = _serializer.CreateODataAction(action, context);
// Assert
Assert.Null(actualAction);
}
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:22,代码来源:ODataEntityTypeSerializerTests.cs
示例3: TestShouldOmitAction
public void TestShouldOmitAction(TestODataMetadataLevel metadataLevel,
bool followsConventions, bool expectedResult)
{
// Arrange
IEdmActionImport action = CreateFakeActionImport(true);
IEdmDirectValueAnnotationsManager annonationsManager = CreateFakeAnnotationsManager();
IEdmModel model = CreateFakeModel(annonationsManager);
ActionLinkBuilder builder = new ActionLinkBuilder((a) => { throw new NotImplementedException(); },
followsConventions);
// Act
bool actualResult = ODataEntityTypeSerializer.ShouldOmitAction(action.Action, builder,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:19,代码来源:ODataEntityTypeSerializerTests.cs
示例4: ShouldSuppressTypeNameSerialization
public void ShouldSuppressTypeNameSerialization(string entryType, string entitySetType,
TestODataMetadataLevel metadataLevel, bool expectedResult)
{
// Arrange
ODataEntry entry = new ODataEntry
{
// The caller uses a namespace-qualified name, which this test leaves empty.
TypeName = "." + entryType
};
IEdmEntityType edmType = CreateEntityTypeWithName(entitySetType);
// Act
bool actualResult = ODataEntityTypeSerializer.ShouldSuppressTypeNameSerialization(entry, edmType,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:18,代码来源:ODataEntityTypeSerializerTests.cs
示例5: CreateODataAction_IncludesTarget
public void CreateODataAction_IncludesTarget(TestODataMetadataLevel metadataLevel, bool followsConventions)
{
// Arrange
Uri expectedTarget = new Uri("aa://Target");
IEdmAction action = CreateFakeAction("IgnoreAction");
ActionLinkBuilder linkBuilder = new ActionLinkBuilder((a) => expectedTarget, followsConventions);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetActionLinkBuilder(action, linkBuilder);
IEdmModel model = CreateFakeModel(annotationsManager);
UrlHelper url = CreateMetadataLinkFactory("http://IgnoreMetadataPath");
EntityInstanceContext context = CreateContext(model, url);
context.SerializerContext.MetadataLevel = (ODataMetadataLevel)metadataLevel;
// Act
ODataAction actualAction = _serializer.CreateODataAction(action, context);
// Assert
Assert.NotNull(actualAction);
Assert.Equal(expectedTarget, actualAction.Target);
}
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:24,代码来源:ODataEntityTypeSerializerTests.cs
示例6: CreateODataAction_OmitsTitle
public void CreateODataAction_OmitsTitle(TestODataMetadataLevel metadataLevel)
{
// Arrange
IEdmEntityContainer container = CreateFakeContainer("IgnoreContainer");
IEdmFunctionImport functionImport = CreateFakeFunctionImport(container, "IgnoreAction");
ActionLinkBuilder linkBuilder = new ActionLinkBuilder((a) => new Uri("aa://Ignore"),
followsConventions: false);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetActionLinkBuilder(functionImport, linkBuilder);
IEdmModel model = CreateFakeModel(annotationsManager);
UrlHelper url = CreateMetadataLinkFactory("http://IgnoreMetadataPath");
EntityInstanceContext context = CreateContext(model, url);
context.SerializerContext.MetadataLevel = (ODataMetadataLevel)metadataLevel;
// Act
ODataAction actualAction = _serializer.CreateODataAction(functionImport, context);
// Assert
Assert.NotNull(actualAction);
Assert.Null(actualAction.Title);
}
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:24,代码来源:ODataEntityTypeSerializerTests.cs
示例7: ShouldSuppressTypeNameSerialization
public void ShouldSuppressTypeNameSerialization(object value, TestODataMetadataLevel metadataLevel,
bool expectedResult)
{
// Act
bool actualResult = ODataPrimitiveSerializer.ShouldSuppressTypeNameSerialization(value,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:nicholaspei,项目名称:aspnetwebstack,代码行数:10,代码来源:ODataPrimitiveSerializerTests.cs
示例8: CreateMetadataFragment_OmitsDefaultContainerName
public void CreateMetadataFragment_OmitsDefaultContainerName(TestODataMetadataLevel metadataLevel)
{
// Arrange
string expectedActionName = "Action";
IEdmEntityContainer container = CreateFakeContainer("ContainerShouldNotAppearInResult");
IEdmFunctionImport action = CreateFakeFunctionImport(container, expectedActionName);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetDefaultContainer(container);
IEdmModel model = CreateFakeModel(annotationsManager);
// Act
string actualFragment = ODataEntityTypeSerializer.CreateMetadataFragment(action, model,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedActionName, actualFragment);
}
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:19,代码来源:ODataEntityTypeSerializerTests.cs
示例9: ShouldAddTypeNameAnnotation
public void ShouldAddTypeNameAnnotation(TestODataMetadataLevel metadataLevel, bool expectedResult)
{
// Act
bool actualResult = ODataEntityTypeSerializer.ShouldAddTypeNameAnnotation(
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataEntityTypeSerializerTests.cs
示例10: CreateMetadataFragment_IncludesNonDefaultContainerName
public void CreateMetadataFragment_IncludesNonDefaultContainerName(TestODataMetadataLevel metadataLevel)
{
// Arrange
string expectedContainerName = "Container";
string expectedActionName = "Action";
IEdmEntityContainer container = CreateFakeContainer(expectedContainerName);
IEdmFunctionImport action = CreateFakeFunctionImport(container, expectedActionName);
IEdmModel model = CreateFakeModel();
// Act
string actualFragment = ODataEntityTypeSerializer.CreateMetadataFragment(action, model,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedContainerName + "." + expectedActionName, actualFragment);
}
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:18,代码来源:ODataEntityTypeSerializerTests.cs
示例11: CreateODataAction_IncludesTitle
public void CreateODataAction_IncludesTitle(TestODataMetadataLevel metadataLevel)
{
// Arrange
string expectedActionName = "Action";
IEdmEntityContainer container = CreateFakeContainer("IgnoreContainer");
IEdmFunctionImport functionImport = CreateFakeFunctionImport(container, expectedActionName);
ActionLinkBuilder linkBuilder = new ActionLinkBuilder((a) => new Uri("aa://IgnoreTarget"),
followsConventions: false);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetActionLinkBuilder(functionImport, linkBuilder);
IEdmModel model = CreateFakeModel(annotationsManager);
UrlHelper url = CreateMetadataLinkFactory("http://IgnoreMetadataPath");
EntityInstanceContext context = CreateContext(model, url);
// Act
ODataAction actualAction = ODataEntityTypeSerializer.CreateODataAction(functionImport, context,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.NotNull(actualAction);
Assert.Equal(expectedActionName, actualAction.Title);
}
开发者ID:sujiantao,项目名称:aspnetwebstack,代码行数:26,代码来源:ODataEntityTypeSerializerTests.cs
示例12: CreateODataFunction_OmitsAction_WhenFollowingConventions
public void CreateODataFunction_OmitsAction_WhenFollowingConventions(TestODataMetadataLevel metadataLevel)
{
// Arrange
IEdmTypeReference returnType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: false);
IEdmFunction function = new EdmFunction("NS", "Function", returnType, isBound: true, entitySetPathExpression: null, isComposable: false);
FunctionLinkBuilder linkBuilder = new FunctionLinkBuilder((EntityInstanceContext a) => new Uri("aa://Ignore"),
followsConventions: true);
IEdmDirectValueAnnotationsManager annotationsManager = CreateFakeAnnotationsManager();
annotationsManager.SetFunctionLinkBuilder(function, linkBuilder);
IEdmModel model = CreateFakeModel(annotationsManager);
UrlHelper url = CreateMetadataLinkFactory("http://IgnoreMetadataPath");
EntityInstanceContext context = CreateContext(model, url);
context.SerializerContext.MetadataLevel = (ODataMetadataLevel)metadataLevel;
// Act
ODataFunction actualFunction = _serializer.CreateODataFunction(function, context);
// Assert
Assert.Null(actualFunction);
}
开发者ID:chinadragon0515,项目名称:WebApi,代码行数:23,代码来源:ODataEntityTypeSerializerTests.cs
示例13: TestShouldOmitAction
public void TestShouldOmitAction(TestODataMetadataLevel metadataLevel, bool isAlwaysAvailable, bool expectedResult)
{
// Arrange
IEdmFunctionImport action = CreateFakeFunctionImport(true);
IEdmDirectValueAnnotationsManager annonationsManager = CreateFakeAnnotationsManager();
if (isAlwaysAvailable)
{
annonationsManager.SetIsAlwaysBindable(action);
}
IEdmModel model = CreateFakeModel(annonationsManager);
// Act
bool actualResult = ODataEntityTypeSerializer.ShouldOmitAction(action, model,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataEntityTypeSerializerTests.cs
示例14: ShouldSuppressTypeNameSerialization
public void ShouldSuppressTypeNameSerialization(string entryType, string entitySetType,
TestODataMetadataLevel metadataLevel, bool expectedResult)
{
// Arrange
ODataEntry entry = new ODataEntry
{
TypeName = entryType
};
IEdmEntitySet entitySet = CreateEntitySetWithElementTypeName(entitySetType);
// Act
bool actualResult = ODataEntityTypeSerializer.ShouldSuppressTypeNameSerialization(entry, null,
(ODataMetadataLevel)metadataLevel);
// Assert
Assert.Equal(expectedResult, actualResult);
}
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:17,代码来源:ODataEntityTypeSerializerTests.cs
注:本文中的TestODataMetadataLevel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论