예제 #1
0
        public void Xml_WithPreserveBom()
        {
            IBaseComponent assembler = Assembler.Xml()
                                       .WithPreserveBom(true).End();

            XmlAsmComp xml = assembler as XmlAsmComp;

            Assert.AreEqual(true, xml.PreserveBom);
        }
예제 #2
0
        public void Xml_WithXmlDeclaration()
        {
            IBaseComponent assembler = Assembler.Xml()
                                       .WithXmlDeclaration(true).End();

            XmlAsmComp xml = assembler as XmlAsmComp;

            Assert.AreEqual(true, xml.AddXMLDeclaration);
        }
예제 #3
0
        public void Xml_CanAddEnvelopeSpec()
        {
            IBaseComponent assembler = Assembler.Xml()
                                       .WithEnvelopeSpec <SimpleEnv>().End();

            XmlAsmComp xml = assembler as XmlAsmComp;

            Assert.AreEqual(1, xml.EnvelopeDocSpecNames.Count);
        }
예제 #4
0
        public void Xml_CanAddDocumentSpec()
        {
            IBaseComponent assembler = Assembler.Xml()
                                       .WithDocumentSpec <Schema1_NPP>().End();

            XmlAsmComp xml = assembler as XmlAsmComp;

            Assert.IsNotNull(xml);
            Assert.AreEqual(1, xml.DocumentSpecNames.Count);
        }
예제 #5
0
        public void EnsureAtMostComponentThrows()
        {
            var pipelinePolicy = new PipelinePolicy {
                Stages =
                {
                    new StagePolicy {
                        StageIdGuid     = StageCategory.AssemblingSerializer.Id.ToString(),
                        ExecutionMethod = ExecMethod.FirstMatch,
                        MaxOccurs       = 1
                    }
                }
            };
            var stage     = new Stage(StageCategory.AssemblingSerializer.Id, pipelinePolicy);
            var component = new XmlAsmComp();

            stage.AddComponent(component);
            stage.AddComponent(component);

            Action(() => stage.As <IVisitable <IPipelineVisitor> >().Accept(new Mock <IPipelineVisitor>().Object))
            .Should().Throw <ArgumentException>()
            .WithMessage("Stage 'AssemblingSerializer' should contain at most 1 components.");
        }
예제 #6
0
        public void CanApplyConfigToPipeline()
        {
            XmlTextReader reader = new XmlTextReader(
                DocLoader.LoadStream("PipelineInstanceConfig.xml")
                );
            SendPipelineWrapper pipeline = Pipelines.Xml.Send()
                                           .WithAssembler(Assembler.Xml())
                                           .WithEncoder(new MIME_SMIME_Encoder())
                                           .WithInstanceConfig(reader);

            XmlAsmComp xmlassm = (XmlAsmComp)
                                 pipeline.GetComponent(PipelineStage.Assemble, 0);

            Assert.IsFalse(xmlassm.AddXMLDeclaration);
            Assert.IsFalse(xmlassm.PreserveBom);

            MIME_SMIME_Encoder enc = (MIME_SMIME_Encoder)
                                     pipeline.GetComponent(PipelineStage.Encode, 0);

            Assert.IsTrue(enc.EnableEncryption);
            Assert.AreEqual(MIME_SMIME_Encoder.MIMETransferEncodingType.SevenBit,
                            enc.ContentTransferEncoding);
        }
예제 #7
0
 internal XmlAssembler()
 {
     _assembler = new XmlAsmComp();
 }