本文整理汇总了C#中Fixture.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Fixture.ToString方法的具体用法?C# Fixture.ToString怎么用?C# Fixture.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fixture
的用法示例。
在下文中一共展示了Fixture.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteMappingFragment_should_write_store_entity_set_name
public void WriteMappingFragment_should_write_store_entity_set_name()
{
var fixture = new Fixture();
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", null, null, entityType);
var entityContainer = new EntityContainer("EC", DataSpace.SSpace);
entityContainer.AddEntitySetBase(entitySet);
var storageEntitySetMapping
= new EntitySetMapping(
entitySet,
new EntityContainerMapping(entityContainer));
TypeMapping typeMapping = new EntityTypeMapping(storageEntitySetMapping);
var mappingFragment = new MappingFragment(entitySet, typeMapping, false);
fixture.Writer.WriteMappingFragmentElement(mappingFragment);
Assert.Equal(
@"<MappingFragment StoreEntitySet=""ES"" />",
fixture.ToString());
}
示例2: WriteFunctionElementHeader_should_write_return_type_attribute_for_primitive_return_type
public void WriteFunctionElementHeader_should_write_return_type_attribute_for_primitive_return_type()
{
var fixture = new Fixture();
var function = new EdmFunction(
"Foo",
"Bar",
DataSpace.SSpace,
new EdmFunctionPayload
{
Schema = "dbo",
ReturnParameters =
new[]
{
new FunctionParameter(
"r",
TypeUsage.CreateDefaultTypeUsage(
PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
ParameterMode.ReturnValue)
}
});
fixture.Writer.WriteFunctionElementHeader(function);
Assert.Equal(
"<Function Name=\"Foo\" Aggregate=\"false\" BuiltIn=\"false\" NiladicFunction=\"false\" IsComposable=\"true\" ParameterTypeSemantics=\"AllowImplicitConversion\" Schema=\"dbo\" ReturnType=\"Int32\"",
fixture.ToString());
}
示例3: WriteEntitySetMappingElement_should_write_modification_function_mappings
public void WriteEntitySetMappingElement_should_write_modification_function_mappings()
{
var fixture = new Fixture();
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", null, null, entityType);
var entityContainer = new EntityContainer("EC", DataSpace.SSpace);
entityContainer.AddEntitySetBase(entitySet);
var storageEntitySetMapping
= new EntitySetMapping(
entitySet,
new EntityContainerMapping(entityContainer));
var storageModificationFunctionMapping
= new ModificationFunctionMapping(
entitySet,
entityType,
new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload()),
Enumerable.Empty<ModificationFunctionParameterBinding>(),
null,
null);
storageEntitySetMapping.AddModificationFunctionMapping(
new EntityTypeModificationFunctionMapping(
entityType,
storageModificationFunctionMapping,
storageModificationFunctionMapping,
storageModificationFunctionMapping));
fixture.Writer.WriteEntitySetMappingElement(storageEntitySetMapping);
Assert.Equal(
@"<EntitySetMapping Name=""ES"">
<EntityTypeMapping TypeName="".E"">
<ModificationFunctionMapping>
<InsertFunction FunctionName=""N.F"" />
<UpdateFunction FunctionName=""N.F"" />
<DeleteFunction FunctionName=""N.F"" />
</ModificationFunctionMapping>
</EntityTypeMapping>
</EntitySetMapping>",
fixture.ToString());
}
示例4: WriteFunctionElementHeader_should_write_element_and_attributes
public void WriteFunctionElementHeader_should_write_element_and_attributes()
{
var fixture = new Fixture();
var function = new EdmFunction(
"Foo",
"Bar",
DataSpace.SSpace,
new EdmFunctionPayload
{
Schema = "dbo"
});
fixture.Writer.WriteFunctionElementHeader(function);
Assert.Equal(
"<Function Name=\"Foo\" Aggregate=\"false\" BuiltIn=\"false\" NiladicFunction=\"false\" IsComposable=\"true\" ParameterTypeSemantics=\"AllowImplicitConversion\" Schema=\"dbo\"",
fixture.ToString());
}
示例5: WriteFunctionMapping_should_write_simple_parameter_and_result_bindings_and_rows_affected_parameter
public void WriteFunctionMapping_should_write_simple_parameter_and_result_bindings_and_rows_affected_parameter()
{
var fixture = new Fixture();
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", null, null, entityType);
new EntityContainer("EC", DataSpace.SSpace).AddEntitySetBase(entitySet);
var property = new EdmProperty("M");
var typeUsage = TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32));
var storageModificationFunctionMapping
= new ModificationFunctionMapping(
entitySet,
entityType,
new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload()),
new[]
{
new ModificationFunctionParameterBinding(
new FunctionParameter(
"P",
typeUsage,
ParameterMode.In),
new ModificationFunctionMemberPath(
new[] { property },
null),
true),
new ModificationFunctionParameterBinding(
new FunctionParameter(
"P_Original",
typeUsage,
ParameterMode.In),
new ModificationFunctionMemberPath(
new[] { property },
null),
false)
},
new FunctionParameter("RowsAffected", typeUsage, ParameterMode.Out),
new[]
{
new ModificationFunctionResultBinding("C", property)
});
fixture.Writer.WriteFunctionMapping("InsertFunction", storageModificationFunctionMapping);
Assert.Equal(
@"<InsertFunction FunctionName=""N.F"" RowsAffectedParameter=""RowsAffected"">
<ScalarProperty Name=""M"" ParameterName=""P"" Version=""Current"" />
<ScalarProperty Name=""M"" ParameterName=""P_Original"" Version=""Original"" />
<ResultBinding Name=""M"" ColumnName=""C"" />
</InsertFunction>",
fixture.ToString());
}
示例6: WriteFunctionImportReturnTypeAttributes_writes_EntitySet_attribute
public void WriteFunctionImportReturnTypeAttributes_writes_EntitySet_attribute()
{
var fixture = new Fixture();
var returnParameter =
new FunctionParameter(
"RetValue",
TypeUsage.CreateDefaultTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
ParameterMode.ReturnValue);
fixture.Writer.WriteFunctionReturnTypeElementHeader();
fixture.Writer.WriteFunctionImportReturnTypeAttributes(returnParameter, new EntitySet { Name = "ES" }, false);
Assert.Equal("<ReturnType Type=\"Int32\" EntitySet=\"ES\"", fixture.ToString());
}
示例7: WriteRowTypeElementHeader_writes_header
public void WriteRowTypeElementHeader_writes_header()
{
var fixture = new Fixture();
fixture.Writer.WriteRowTypeElementHeader();
Assert.Equal("<RowType", fixture.ToString());
}
示例8: WriteFunctionMapping_should_write_complex_parameter_bindings
public void WriteFunctionMapping_should_write_complex_parameter_bindings()
{
var fixture = new Fixture();
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", null, null, entityType);
new EntityContainer("EC", DataSpace.SSpace).AddEntitySetBase(entitySet);
var storageModificationFunctionMapping
= new ModificationFunctionMapping(
entitySet,
entityType,
new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload()),
new[]
{
new ModificationFunctionParameterBinding(
new FunctionParameter(
"P",
TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
ParameterMode.In),
new ModificationFunctionMemberPath(
new[]
{
EdmProperty.CreateComplex("C1", new ComplexType()),
EdmProperty.CreateComplex("C2", new ComplexType()),
new EdmProperty("M")
},
null),
true)
},
null,
null);
fixture.Writer.WriteFunctionMapping("InsertFunction", storageModificationFunctionMapping);
Assert.Equal(
@"<InsertFunction FunctionName=""N.F"">
<ComplexProperty Name=""C1"" TypeName=""."">
<ComplexProperty Name=""C2"" TypeName=""."">
<ScalarProperty Name=""M"" ParameterName=""P"" Version=""Current"" />
</ComplexProperty>
</ComplexProperty>
</InsertFunction>",
fixture.ToString());
}
示例9: WriteFunctionImportReturnTypeAttributes_writes_Type_attribute_for_non_inline_definition
public void WriteFunctionImportReturnTypeAttributes_writes_Type_attribute_for_non_inline_definition()
{
var fixture = new Fixture();
var returnParameter =
new FunctionParameter(
"RetValue",
TypeUsage.CreateDefaultTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
ParameterMode.ReturnValue);
fixture.Writer.WriteFunctionReturnTypeElementHeader();
fixture.Writer.WriteFunctionImportReturnTypeAttributes(returnParameter, null, false);
Assert.Equal("<ReturnType Type=\"Int32\"", fixture.ToString());
}
示例10: WriteExtendedProperties_writes_annotations_using_ToString_if_serializer_not_available
public void WriteExtendedProperties_writes_annotations_using_ToString_if_serializer_not_available()
{
var property = MetadataProperty.CreateAnnotation(XmlConstants.UseClrTypesAnnotationWithPrefix, "true");
var mockEntityType = new Mock<EntityType>("E", "ns", DataSpace.CSpace);
mockEntityType.Setup(m => m.MetadataProperties).Returns(
new ReadOnlyMetadataCollection<MetadataProperty>(new List<MetadataProperty>() { property }));
var fixture = new Fixture(2.0);
fixture.UnderlyingWriter.WriteStartElement(XmlConstants.EntityType);
fixture.Writer.WriteExtendedProperties(mockEntityType.Object);
Assert.Equal(@"<EntityType p1:UseClrTypes=""true""", fixture.ToString());
}
示例11: WriteExtendedProperties_writes_annotations_on_properties
public void WriteExtendedProperties_writes_annotations_on_properties()
{
var annotation = MetadataProperty.CreateAnnotation(XmlConstants.CustomAnnotationPrefix + "Foo", "Goo");
var mockProperty = new Mock<MetadataProperty>();
mockProperty.Setup(m => m.MetadataProperties).Returns(
new ReadOnlyMetadataCollection<MetadataProperty>(new List<MetadataProperty>() { annotation }));
var fixture = new Fixture(2.0);
fixture.UnderlyingWriter.WriteStartElement(XmlConstants.Property);
fixture.Writer.WriteExtendedProperties(mockProperty.Object);
Assert.Equal(@"<Property p1:Foo=""Goo""", fixture.ToString());
}
示例12: WriteSchemaElementHeader_does_not_write_StoreSchemaGen_namespace_declaration_if_not_requested
public void WriteSchemaElementHeader_does_not_write_StoreSchemaGen_namespace_declaration_if_not_requested()
{
var fixture = new Fixture(2.0);
fixture.Writer.WriteSchemaElementHeader("Room.Store", "fakeProvider", "42", false);
Assert.Equal(@"<Schema Namespace=""Room.Store"" Provider=""fakeProvider"" ProviderManifestToken=""42"" Alias=""Self"" xmlns:customannotation=""http://schemas.microsoft.com/ado/2013/11/edm/customannotation""",
fixture.ToString());
}
示例13: WriteEnumTypeElementHeader_writes_annotations
public void WriteEnumTypeElementHeader_writes_annotations()
{
var property = MetadataProperty.CreateAnnotation(XmlConstants.ClrTypeAnnotationWithPrefix, typeof(Random));
var mockEnumType = new Mock<EnumType>();
mockEnumType.Setup(m => m.Name).Returns("E");
mockEnumType.Setup(m => m.MetadataProperties).Returns(
new ReadOnlyMetadataCollection<MetadataProperty>(new List<MetadataProperty>() { property }));
var fixture = new Fixture(2.0);
fixture.Writer.WriteEnumTypeElementHeader(mockEnumType.Object);
Assert.Equal(
@"<EnumType Name=""E"" IsFlags=""false"" p1:ClrType=""System.Random, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"" UnderlyingType=""Int32""",
fixture.ToString());
}
示例14: EdmProperty
//.........这里部分代码省略.........
var entityType = new EntityType("ET", "Ns", DataSpace.CSpace);
entityType.AddMember(entityTypeProperty1);
entityType.AddMember(entityTypeProperty2);
var functionImport =
new EdmFunction(
"f_c", "Ns", DataSpace.CSpace,
new EdmFunctionPayload
{
IsComposable = false,
IsFunctionImport = true,
ReturnParameters =
new[]
{
new FunctionParameter(
"ReturnValue",
TypeUsage.CreateDefaultTypeUsage(entityType.GetCollectionType()),
ParameterMode.ReturnValue)
},
});
typeUsage = ProviderRegistry.Sql2008_ProviderManifest.GetStoreType(typeUsage);
var rowTypeProperty1 = new EdmProperty("RTProperty1", typeUsage);
var rowTypeProperty2 = new EdmProperty("RTProperty2", typeUsage);
var rowType = new RowType(new[] { rowTypeProperty1, rowTypeProperty2 });
var storeFunction =
new EdmFunction(
"f_s", "Ns.Store", DataSpace.SSpace,
new EdmFunctionPayload
{
IsComposable = false,
ReturnParameters =
new[]
{
new FunctionParameter(
"Return",
TypeUsage.CreateDefaultTypeUsage(rowType),
ParameterMode.ReturnValue)
},
});
var functionImportResultMapping = new FunctionImportResultMapping();
functionImportResultMapping.AddTypeMapping(
new FunctionImportEntityTypeMapping(
new EntityType[0],
new [] { entityType },
new Collections.ObjectModel.Collection<FunctionImportReturnTypePropertyMapping>()
{
new FunctionImportReturnTypeScalarPropertyMapping("ETProperty1", "RTProperty1"),
new FunctionImportReturnTypeScalarPropertyMapping("ETProperty2", "RTProperty2")
},
new FunctionImportEntityTypeMappingCondition[]
{
new FunctionImportEntityTypeMappingConditionIsNull("RTProperty1", false),
new FunctionImportEntityTypeMappingConditionValue("RTProperty2", 4),
new FunctionImportEntityTypeMappingConditionValue("FakeCondition", true)
}
));
var mappingItemCollection =
new StorageMappingItemCollection(
new EdmItemCollection(EdmModel.CreateConceptualModel()),
new StoreItemCollection(
EdmModel.CreateStoreModel(ProviderRegistry.Sql2008_ProviderInfo, ProviderRegistry.Sql2008_ProviderManifest)),
new string[0]);
var containerMapping =
new EntityContainerMapping(
new EntityContainer("C", DataSpace.CSpace), new EntityContainer("S", DataSpace.SSpace), mappingItemCollection, false);
var functionImportMapping =
new FunctionImportMappingNonComposable(
functionImport,
storeFunction,
new []
{
functionImportResultMapping
},
containerMapping);
containerMapping.AddFunctionImportMapping(functionImportMapping);
var fixture = new Fixture();
fixture.Writer.WriteFunctionImportMappingElement(functionImportMapping);
Assert.Equal(
@"<FunctionImportMapping FunctionName=""Ns.Store.f_s"" FunctionImportName=""f_c"">
<ResultMapping>
<EntityTypeMapping TypeName=""Ns.ET"">
<ScalarProperty Name=""ETProperty1"" ColumnName=""RTProperty1"" />
<ScalarProperty Name=""ETProperty2"" ColumnName=""RTProperty2"" />
<Condition ColumnName=""RTProperty1"" IsNull=""false"" />
<Condition ColumnName=""RTProperty2"" Value=""4"" />
<Condition ColumnName=""FakeCondition"" Value=""1"" />
</EntityTypeMapping>
</ResultMapping>
</FunctionImportMapping>",
fixture.ToString());
}
示例15: WriteSchemaElementHeader_writes_annotation_prefix_for_UseStrongSpatialTypes_attribute
public void WriteSchemaElementHeader_writes_annotation_prefix_for_UseStrongSpatialTypes_attribute()
{
var fixture = new Fixture();
fixture.Writer.WriteSchemaElementHeader("test");
Assert.Equal(@"<Schema Namespace=""test"" Alias=""Self"" annotation:UseStrongSpatialTypes=""false"" xmlns:annotation=""http://schemas.microsoft.com/ado/2009/02/edm/annotation"" xmlns:customannotation=""http://schemas.microsoft.com/ado/2013/11/edm/customannotation""",
fixture.ToString());
}