예제 #1
0
        public void NewtonsoftJson_NamingStratNone_NoOverride_NameIsNotConverted()
        {
            WorkspaceBuilder.ProcessorSettings.NamingStrategy = NamingStrategy.Create(NamingStrategyType.None);
            TestClassBuilder builder = AddExtractedClass("MyType");

            builder.AddPropertyAndBuildAttributes("PropName", "string")
            .AddAttribute(KnownTypes.NewtonsoftJsonPropertyName_v12)
            .Commit();

            builder.Commit();

            AssertClassScriptTextIs(@"
/**  */
export interface MyType {
	/**  */
	PropName: string;
}");
        }
예제 #2
0
        public void DefaultCamelCase_PropNamesAreConverted()
        {
            WorkspaceBuilder.ProcessorSettings.NamingStrategy = NamingStrategy.Create(NamingStrategyType.Camel);
            TestClassBuilder builder = AddExtractedClass("MyType");

            builder.AddPropertyAndBuildAttributes("PropName", "string")
            .AddAttribute(KnownTypes.NewtonsoftJsonPropertyName_v12)
            .Commit();

            builder.Commit();

            AssertClassScriptTextIs(@"
/**  */
export interface MyType {
	/**  */
	propName: string;
}");
        }
예제 #3
0
        public void NewtonsoftJson_NameIsConverted()
        {
            TestClassBuilder builder = AddExtractedClass("MyType");

            builder.AddPropertyAndBuildAttributes("PropName", "string")
            .AddAttribute(KnownTypes.NewtonsoftJsonPropertyName_v12)
            .AddNamedArg("PropertyName", "\"name\"")
            .Commit();

            builder.Commit();

            AssertClassScriptTextIs(@"
/**  */
export interface MyType {
	/**  */
	name: string;
}");
        }