protected override void BeginProcessing() { base.BeginProcessing(); Options = new XsdCodeGeneratorOptions { UseNullableTypes = UseNullable.ToBool() || All.ToBool(), HideUnderlyingNullableProperties = UseNullable.ToBool() || All.ToBool(), OutputNamespace = Namespace, MixedContent = MixedContent.ToBool(), ExcludeImportedTypes = ExcludeImports.ToBool() || All.ToBool(), ExcludeImportedTypesByNameAndNamespace = ExcludeImportsByName.ToBool(), Imports = Imports?.Select(GetPath).ToList() ?? new System.Collections.Generic.List <string>(), UsingNamespaces = Usings?.ToList() ?? new System.Collections.Generic.List <string>(), Language = Language, WriteFileHeader = WriteHeader.ToBool(), PreserveOrder = PreserveOrder.ToBool(), EnableDataBinding = EnableDataBinding.ToBool(), UseLists = UseLists.ToBool() || All.ToBool(), UseXLinq = UseXlinq.ToBool(), AttributesToRemove = new System.Collections.Generic.HashSet <string>(RemoveAttributes ?? Enumerable.Empty <string>()), EnumValueCapitalizer = EnumCapitalizer ?? new NoneCapitalizer(), TypeNameCapitalizer = TypeCapitalizer ?? new NoneCapitalizer(), PropertyNameCapitalizer = PropertyCapitalizer ?? new NoneCapitalizer(), ExcludeXmlTypes = new System.Collections.Generic.HashSet <string>(ExcludeXmlTypes ?? Enumerable.Empty <string>()), AdditionalRootTypes = new System.Collections.Generic.HashSet <string>(AdditionalRootTypes ?? Enumerable.Empty <string>()), AllTypesAreRoot = AllTypesAreRoot.ToBool() }; if (PclTarget) { Options.AttributesToRemove.Add("System.SerializableAttribute"); Options.AttributesToRemove.Add("System.ComponentModel.DesignerCategoryAttribute"); } if (StripDebugAttributes || All) { Options.AttributesToRemove.Add("System.Diagnostics.DebuggerStepThroughAttribute"); } if (All) { if (Options.EnumValueCapitalizer is NoneCapitalizer) { Options.EnumValueCapitalizer = new FirstCharacterCapitalizer(); } if (Options.TypeNameCapitalizer is NoneCapitalizer) { Options.TypeNameCapitalizer = new FirstCharacterCapitalizer(); } if (Options.PropertyNameCapitalizer is NoneCapitalizer) { Options.PropertyNameCapitalizer = new FirstCharacterCapitalizer(); } } }
public void Test_02_Multipart_MixedContent() { object Decoded = this.Decode("0b9e5696-c32a-4418-a246-babb188e5beb"); MixedContent MixedContent = Decoded as MixedContent; Assert.IsNotNull(MixedContent); Assert.AreEqual(3, MixedContent.Content.Length); RelatedContent RelatedContent = MixedContent.Content[0].Decoded as RelatedContent; Assert.IsNotNull(RelatedContent); Assert.AreEqual(2, RelatedContent.Content.Length); ContentAlternatives Alternatives = RelatedContent.Content[0].Decoded as ContentAlternatives; Assert.IsNotNull(Alternatives); Assert.IsTrue(RelatedContent.Content[1].Decoded is SkiaSharp.SKImage); File.WriteAllBytes("Data\\" + RelatedContent.Content[1].FileName, RelatedContent.Content[1].TransferDecoded ?? RelatedContent.Content[1].Raw); Assert.AreEqual(2, Alternatives.Content.Length); string PlainText = Alternatives.Content[0].Decoded as string; Assert.IsNotNull(PlainText); Console.Out.WriteLine(PlainText); Console.Out.WriteLine(); HtmlDocument Html = Alternatives.Content[1].Decoded as HtmlDocument; Assert.IsNotNull(Html); Console.Out.WriteLine(Html.HtmlText); Console.Out.WriteLine(); string Attachment1 = MixedContent.Content[1].Decoded as string; Assert.IsNotNull(Attachment1); Console.Out.WriteLine(Attachment1); Console.Out.WriteLine(); XmlDocument Attachment2 = MixedContent.Content[2].Decoded as XmlDocument; Assert.IsNotNull(Attachment2); Console.Out.WriteLine(Attachment2.OuterXml); Console.Out.WriteLine(); }
public void Test_03_Delivery_Status_Notification() { object Decoded = this.Decode("015dd6dd-ed9f-4139-995b-513f7464dd6f"); MixedContent MixedContent = Decoded as MixedContent; Assert.IsNotNull(MixedContent); Assert.AreEqual(2, MixedContent.Content.Length); string HumanReadable = MixedContent.Content[0].Decoded as string; Assert.IsNotNull(HumanReadable); Console.Out.WriteLine(HumanReadable); Console.Out.WriteLine(); DeliveryStatus Dsn = MixedContent.Content[1].Decoded as DeliveryStatus; Assert.IsNotNull(Dsn); Console.Out.WriteLine(Dsn.Text); Console.Out.WriteLine(); Assert.AreEqual("s554.loopia.se", Dsn.PerMessage.ReportingMta); Assert.AreEqual("dns", Dsn.PerMessage.ReportingMtaType); Assert.AreEqual(new DateTimeOffset(2019, 01, 23, 22, 15, 51, TimeSpan.FromHours(1)), Dsn.PerMessage.ArrivalDate); Assert.AreEqual(2, Dsn.PerMessage.Other.Length); Assert.AreEqual("X-Postfix-Queue-ID", Dsn.PerMessage.Other[0].Key); Assert.AreEqual("0DC1E1F17438", Dsn.PerMessage.Other[0].Value); Assert.AreEqual("X-Postfix-Sender", Dsn.PerMessage.Other[1].Key); Assert.AreEqual(1, Dsn.PerRecipients.Length); Assert.AreEqual("rfc822", Dsn.PerRecipients[0].FinalRecipientType); Assert.AreEqual("rfc822", Dsn.PerRecipients[0].OriginalRecipientType); Assert.AreEqual(Content.Dsn.Action.relayed, Dsn.PerRecipients[0].Action); Assert.AreEqual(2, Dsn.PerRecipients[0].Status[0]); Assert.AreEqual(6, Dsn.PerRecipients[0].Status[1]); Assert.AreEqual(0, Dsn.PerRecipients[0].Status[2]); Assert.AreEqual("waher.se", Dsn.PerRecipients[0].RemoteMta); Assert.AreEqual("dns", Dsn.PerRecipients[0].RemoteMtaType); Assert.AreEqual("250 2.6.0 <*****@*****.**> Message accepted for delivery.", Dsn.PerRecipients[0].DiagnosticCode); Assert.AreEqual("smtp", Dsn.PerRecipients[0].DiagnosticCodeType); }