public void ResolveEnvelopingMapFromRegularSchemaWithoutAnnotation() { var annotations = new SchemaMetadata(typeof(UnannotatedSchema)).Annotations; Assert.That(annotations, Is.TypeOf <SchemaAnnotations.EmptySchemaAnnotations>()); Assert.That(annotations.EnvelopingMap, Is.Null); }
public void ExtractorCollectionIsEmptyForEmptySchemaAnnotationReader() { var sut = new PropertyExtractorAnnotation(); sut.Build(new SchemaAnnotationReader.EmptySchemaAnnotationReader(SchemaMetadata.For <RootedSchema>())); sut.Extractors.Should().BeEmpty().And.BeOfType <PropertyExtractorCollection.EmptyPropertyExtractorCollection>(); }
public void ExtractorCollectionIsNotEmptyWhenSchemaHasSomeAnnotations() { SchemaMetadata.For <RootedSchema>().Annotations.Find <PropertyExtractorAnnotation>().Extractors .Should().BeEquivalentTo( new PropertyExtractorCollection( new XPathExtractor(BizTalkFactoryProperties.MapTypeName, "/*[local-name()='Root']//*[local-name()='Id']") )); }
public void ResolveEnvelopeMapAnnotationFromEnvelopeSchemaWithoutAnnotations() { var schemaMetadata = SchemaMetadata.For <Batch.Content>(); schemaMetadata.GetEnvelopeMap().Should().BeNull(); schemaMetadata.GetPropertyExtractors().Should().BeEquivalentTo( new XPathExtractor(BizTalkFactoryProperties.EnvironmentTag.QName, "/*/*[local-name()='EnvironmentTag']", ExtractionMode.Promote), new XPathExtractor(TrackingProperties.Value1.QName, "/*/*[local-name()='EnvelopeSpecName']", ExtractionMode.Write), new XPathExtractor(TrackingProperties.Value2.QName, "/*/*[local-name()='EnvironmentTag']", ExtractionMode.Write), new XPathExtractor(TrackingProperties.Value3.QName, "/*/*[local-name()='Partition']", ExtractionMode.Write)); }
public void ResolveEnvelopingMapFromEnvelopeSchemaWithAnnotations() { var annotations = new SchemaMetadata(typeof(AnnotatedSchema)).Annotations; Assert.That(annotations, Is.Not.TypeOf <SchemaAnnotations.EmptySchemaAnnotations>()); Assert.That(annotations.EnvelopingMap, Is.EqualTo(typeof(IdentityTransform))); Assert.That(annotations.Extractors.Count(), Is.EqualTo(1)); Assert.That( annotations.Extractors, Is.EquivalentTo( new[] { new XPathExtractor(TrackingProperties.Value1.QName, "/*[local-name()='Send']/*[local-name()='Message']/*[local-name()='Id']", ExtractionMode.Write) })); }
public void FindEntailsSchemaAnnotationInstanceBuildingForEachSchema() { SchemaAnnotationCollection.Create(SchemaMetadata.For <Envelope>()).Find <AnnotationDummy>().Should().NotBeNull(); AnnotationDummy.AnnotationDummySpy .Verify(ads => ads.Build(It.IsAny <ISchemaAnnotationReader>()), Times.Once); SchemaAnnotationCollection.Create(SchemaMetadata.For <Any>()).Find <AnnotationDummy>().Should().NotBeNull(); AnnotationDummy.AnnotationDummySpy .Verify(ads => ads.Build(It.IsAny <ISchemaAnnotationReader>()), Times.Once); SchemaAnnotationCollection.Create(SchemaMetadata.For <BTS.soap_envelope_1__2.Fault>()).Find <AnnotationDummy>().Should().NotBeNull(); AnnotationDummy.AnnotationDummySpy .Verify(ads => ads.Build(It.IsAny <ISchemaAnnotationReader>()), Times.Once); }
public void ResolveEnvelopingMapFromEnvelopeSchemaWithoutAnnotations() { var annotations = new SchemaMetadata(typeof(Batch.Content)).Annotations; Assert.That(annotations, Is.Not.TypeOf <SchemaAnnotations.EmptySchemaAnnotations>()); Assert.That(annotations.EnvelopingMap, Is.Null); Assert.That(annotations.Extractors.Count(), Is.EqualTo(4)); Assert.That( annotations.Extractors, Is.EquivalentTo( new[] { new XPathExtractor(BizTalkFactoryProperties.EnvironmentTag.QName, "/*/*[local-name()='EnvironmentTag']", ExtractionMode.Promote), new XPathExtractor(TrackingProperties.Value1.QName, "/*/*[local-name()='EnvelopeSpecName']", ExtractionMode.Write), new XPathExtractor(TrackingProperties.Value2.QName, "/*/*[local-name()='EnvironmentTag']", ExtractionMode.Write), new XPathExtractor(TrackingProperties.Value3.QName, "/*/*[local-name()='Partition']", ExtractionMode.Write) })); }
public void FindEntailsSingleSchemaAnnotationInstanceBuildingForOneSchema() { // notice we create and reuse SchemaAnnotationCollection similarly to what SchemaMetadata does var schemaAnnotationCollection = SchemaAnnotationCollection.Create(SchemaMetadata.For <Envelope>()); var annotationDummy = schemaAnnotationCollection.Find <AnnotationDummy>(); annotationDummy.Should().NotBeNull(); AnnotationDummy.AnnotationDummySpy .Verify(ads => ads.Build(It.IsAny <ISchemaAnnotationReader>()), Times.Once); AnnotationDummy.AnnotationDummySpy.Invocations.Clear(); // build is not called anymore and same SchemaAnnotation instance is returned schemaAnnotationCollection.Find <AnnotationDummy>().Should().BeSameAs(annotationDummy); AnnotationDummy.AnnotationDummySpy .Verify(ads => ads.Build(It.IsAny <ISchemaAnnotationReader>()), Times.Never); }
public void ExtractorCollectionIsEmptyForMicrosoftSoap12Schema() { SchemaMetadata.For <BTS.soap_envelope_1__2.Fault>().Annotations.Find <PropertyExtractorAnnotation>().Extractors.Should().BeEmpty(); }
public void IsEnvelopeSchemaForNonEnvelopeSchema() { SchemaMetadata.For <Any>().IsEnvelopeSchema.Should().BeFalse(); }
public void FindReturnsSameAnnotationInstanceForSameSchema() { SchemaMetadata.For <BTS.soap_envelope_1__2.Fault>().Annotations.Find <AnnotationDummy>() .Should().BeSameAs(SchemaMetadata.For <BTS.soap_envelope_1__2.Fault>().Annotations.Find <AnnotationDummy>()); }
public void GetTargetNamespaceForRootlessSchema() { SchemaMetadata.For <RootlessSchema>().TargetNamespace.Should().Be("urn:schemas.stateless.be:unit:type"); }
public void IsEnvelopeSchemaForEnvelopeSchema() { SchemaMetadata.For <Envelope>().IsEnvelopeSchema.Should().BeTrue(); }
public void FindReturnsSoughtSchemaAnnotationInstance() { SchemaMetadata.For <BTS.soap_envelope_1__2.Fault>().Annotations.Find <AnnotationDummy>().Should().BeOfType <AnnotationDummy>(); }
public void GetTargetNamespaceForRootedSchema() { SchemaMetadata.For <Any>().TargetNamespace.Should().Be("urn:schemas.stateless.be:biztalk:any:2012:12"); }
public void ExtractorCollectionIsEmptyWhenSchemaHasNoAnnotation() { SchemaMetadata.For <Envelope>().Annotations.Find <PropertyExtractorAnnotation>().Extractors.Should().BeEmpty(); }
public void GetExtractorsIsAnAcceleratorExtensionMethod() { SchemaMetadata.For <RootedSchema>().Annotations.Find <PropertyExtractorAnnotation>().Extractors .Should().BeSameAs(SchemaMetadata.For <RootedSchema>().GetPropertyExtractors()); }
public void GetDocumentSpecForRootlessSchema() { SchemaMetadata.For <RootlessSchema>().DocumentSpec.Should().BeNull(); }
public void ResolveEnvelopeMapAnnotationFromEnvelopeSchemaWithAnnotations() { var schemaMetadata = SchemaMetadata.For <AnnotatedSchema>(); schemaMetadata.GetEnvelopeMap().Should().Be <IdentityTransform>(); }
public void GetDocumentSpecForRootedSchema() { SchemaMetadata.For <Any>().DocumentSpec.Should().BeEquivalentTo(new DocumentSpec(typeof(Any).FullName, typeof(Any).Assembly.FullName)); }
public void GetBodyXPathForNonEnvelopeSchema() { SchemaMetadata.For <Any>().BodyXPath.Should().BeEmpty(); }
public void GetBodyXPathForEnvelopeSchema() { SchemaMetadata.For <Envelope>().BodyXPath.Should().Be("/*[local-name()='Envelope' and namespace-uri()='urn:schemas.stateless.be:biztalk:envelope:2013:07']"); }
public void GetAnnotationByNameIsNullForUnknownAnnotation() { SchemaMetadata.For <RootedSchema>().Annotations.GetAnnotation("UnknownAnnotation").Should().BeNull(); }
public void GetAnnotationByNameIsNotNullForKnownAnnotation() { SchemaMetadata.For <RootedSchema>().Annotations.GetAnnotation("Properties").Should().NotBeNull(); }
public void FindReturnsDifferentAnnotationInstanceForDifferentSchema() { SchemaMetadata.For <RootedSchema>().Annotations.Find <AnnotationDummy>() .Should().NotBeSameAs(SchemaMetadata.For <Any>().Annotations.Find <AnnotationDummy>()); }
public void GetRootElementNameForRootedSchema() { SchemaMetadata.For <Any>().RootElementName.Should().Be("Any"); }
public void GetMessageTypeForRootedSchema() { SchemaMetadata.For <Any>().MessageType.Should().Be("urn:schemas.stateless.be:biztalk:any:2012:12#Any"); }
public void GetRootElementNameForRootlessSchema() { SchemaMetadata.For <RootlessSchema>().RootElementName.Should().BeEmpty(); }
public void ResolveEnvelopeMapAnnotationFromRegularSchemaWithoutAnnotation() { var schemaMetadata = SchemaMetadata.For <UnannotatedSchema>(); schemaMetadata.GetEnvelopeMap().Should().BeNull(); }
public void GetMessageTypeForRootlessSchema() { SchemaMetadata.For <RootlessSchema>().MessageType.Should().BeEmpty(); }