本文整理汇总了C#中CodeGenerator.WriteToStream方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenerator.WriteToStream方法的具体用法?C# CodeGenerator.WriteToStream怎么用?C# CodeGenerator.WriteToStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.WriteToStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultipleParameterGeneratesCode
public void MultipleParameterGeneratesCode()
{
// Arrange
IContainer container = new Container ();
container.Register<ISimpleObject, SimpleObject> ();
container.Register<IShallowDependent, ShallowDependent> ();
container.Register<IDeepDependent, DeepDependent> ();
container.Register<IMultipleParameterObject, MultipleParameterObject> ();
CodeGenerator codeGenerator = new CodeGenerator ();
MemoryStream memoryStream = new MemoryStream ();
// Act
codeGenerator.WriteToStream(LanguageEnum.Csharp, container, memoryStream, "SomeNamespace", "TestContainer");
memoryStream.Position = 0;
string charpString;
using (StreamReader reader = new StreamReader(memoryStream)) {
charpString = reader.ReadToEnd ();
}
TestContainer testContainer = new TestContainer ();
IMultipleParameterObject result = testContainer.Resolve<IMultipleParameterObject> ();
// Assert
Assert.IsNotNull (result);
Assert.IsNotNull (result.ShallowDependent);
Assert.IsNotNull (result.SimpleObject);
}
开发者ID:JamesRandall,项目名称:AccidentalFish.Xamarin.DependencyInjection,代码行数:26,代码来源:CsharpGeneratorTests.cs
示例2: SimpleContainerGeneratesCode
public void SimpleContainerGeneratesCode()
{
// Arrange
IContainer container = new Container ();
container.Register<ISimpleObject, SimpleObject> ();
CodeGenerator codeGenerator = new CodeGenerator ();
MemoryStream memoryStream = new MemoryStream ();
// Act
codeGenerator.WriteToStream(LanguageEnum.Csharp, container, memoryStream, "SomeNamespace", "TestContainer");
memoryStream.Position = 0;
string charpString;
using (StreamReader reader = new StreamReader(memoryStream)) {
charpString = reader.ReadToEnd ();
}
// Assert
Assert.IsNotNull (charpString);
}
开发者ID:JamesRandall,项目名称:AccidentalFish.Xamarin.DependencyInjection,代码行数:20,代码来源:CsharpGeneratorTests.cs