public static string ToFlagString(this StrictNullTypeUnionFlags strictNullTypeUnionFlags) { var result = ""; if (strictNullTypeUnionFlags.HasFlag(StrictNullTypeUnionFlags.Null)) { result += "null "; } if (strictNullTypeUnionFlags.HasFlag(StrictNullTypeUnionFlags.Undefined)) { result += "undefined "; } return(result.TrimEnd().Replace(" ", "|")); }
public void GetTsTypeName_MemberGiven_TsTypeNameReturned(MemberInfo memberInfo, TypeNameConverterCollection converters, StrictNullTypeUnionFlags csNullableTranslation, string expectedResult) { //arrange var generatorOptionsProvider = new GeneratorOptionsProvider { GeneratorOptions = new GeneratorOptions { TypeNameConverters = converters, CsNullableTranslation = csNullableTranslation } }; _typeService = new TypeService(_metadataReaderFactory, generatorOptionsProvider); //act string actualResult = _typeService.GetTsTypeName(memberInfo); //assert Assert.Equal(expectedResult, actualResult); }
public void ToStrictNullFlags_StringTranslationGiven_FlagsReturned(string input, StrictNullTypeUnionFlags expectedResult) { StrictNullTypeUnionFlags actualResult = input.ToStrictNullFlags(); Assert.Equal(expectedResult, actualResult); }
public void ToFlagString_FlagsGiven_StringTranslationReturned(StrictNullTypeUnionFlags typeUnionFlags, string expectedResult) { string actualResult = typeUnionFlags.ToFlagString(); Assert.Equal(expectedResult, actualResult); }