Beispiel #1
0
        public void Resolve_MultipleFilesAndEndpoints_AllDiscovered()
        {
            string wsdlFile    = TestFiles.GetFilePath(TestFiles.RestaurantServiceWsdlFileName);
            string dataFile    = TestFiles.GetFilePath(TestFiles.RestaurantDataXsdFileName);
            string headerFile  = TestFiles.GetFilePath(TestFiles.RestaurantHeaderDataXsdFileName);
            string messageFile = TestFiles.GetFilePath(TestFiles.RestaurantMessagesXsdFileName);

            Mock <IMexMetadataResolver> mexResolver = new Mock <IMexMetadataResolver>();
            Mock <IXmlMetadataResolver> xmlResolver = new Mock <IXmlMetadataResolver>();

            IMetadataDiscovery metadataDiscovery = new MetadataDiscovery(mexResolver.Object, xmlResolver.Object);

            metadataDiscovery.Process(wsdlFile, dataFile, headerFile, messageFile,
                                      TestHost.NamedPipeMexAddress,
                                      TestHost.TcpMexAddress,
                                      TestHost.HttpMexAddress,
                                      TestHost.HttpGetAddress);

            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == wsdlFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == dataFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == headerFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == messageFile)), Times.Once());

            mexResolver.Verify(mock => mock.Resolve(It.Is <Uri>(v => v.AbsoluteUri == TestHost.NamedPipeMexAddress)), Times.Once());
            mexResolver.Verify(mock => mock.Resolve(It.Is <Uri>(v => v.AbsoluteUri == TestHost.TcpMexAddress)), Times.Once());
            mexResolver.Verify(mock => mock.Resolve(It.Is <Uri>(v => v.AbsoluteUri == TestHost.HttpMexAddress)), Times.Once());
            mexResolver.Verify(mock => mock.Resolve(It.Is <Uri>(v => v.AbsoluteUri == TestHost.HttpGetAddress)), Times.Once());
        }
Beispiel #2
0
        public void Resolve_XsdFile_ImportsDiscovered()
        {
            string xsdFileName = TestFiles.GetFilePath(TestFiles.RestaurantMessagesXsdFileName);
            IEnumerable <MetadataSection> metadataSections = DiscoveryMetadataResolver.Resolve(xsdFileName);

            Assert.That(metadataSections, Has.Count.EqualTo(2));
            Assert.That(metadataSections.Count(m => m.Identifier == TestNamespaces.DataNamespace), Is.EqualTo(1));
            Assert.That(metadataSections.Count(m => m.Identifier == TestNamespaces.MessageNamespace), Is.EqualTo(1));
        }
        public void Resolve_XsdFile_MetadataImported()
        {
            string                        xsdFileName      = TestFiles.GetFilePath(TestFiles.RestaurantDataXsdFileName);
            FileInfo                      xsdFileInfo      = new FileInfo(xsdFileName);
            IXmlMetadataResolver          resolver         = new XmlMetadataResolver();
            IEnumerable <MetadataSection> metadataSections = resolver.Resolve(xsdFileInfo);

            Assert.That(metadataSections, Has.Count.EqualTo(1));
            Assert.That(metadataSections.Count(m => m.Identifier == TestNamespaces.DataNamespace), Is.EqualTo(1));
        }
Beispiel #4
0
        public void Resolve_SingleExplicitFile_Discovered()
        {
            string wsdlFile = TestFiles.GetFilePath(TestFiles.RestaurantServiceWsdlFileName);

            Mock <IMexMetadataResolver> mexResolver = new Mock <IMexMetadataResolver>();
            Mock <IXmlMetadataResolver> xmlResolver = new Mock <IXmlMetadataResolver>();

            IMetadataDiscovery metadataDiscovery = new MetadataDiscovery(mexResolver.Object, xmlResolver.Object);

            metadataDiscovery.Process(wsdlFile);

            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == wsdlFile)), Times.Once());
        }
Beispiel #5
0
        public void Resolve_MultipleExplicitFiles_AllDiscovered()
        {
            string wsdlFile    = TestFiles.GetFilePath(TestFiles.RestaurantServiceWsdlFileName);
            string dataFile    = TestFiles.GetFilePath(TestFiles.RestaurantDataXsdFileName);
            string headerFile  = TestFiles.GetFilePath(TestFiles.RestaurantHeaderDataXsdFileName);
            string messageFile = TestFiles.GetFilePath(TestFiles.RestaurantMessagesXsdFileName);

            Mock <IMexMetadataResolver> mexResolver = new Mock <IMexMetadataResolver>();
            Mock <IXmlMetadataResolver> xmlResolver = new Mock <IXmlMetadataResolver>();

            IMetadataDiscovery metadataDiscovery = new MetadataDiscovery(mexResolver.Object, xmlResolver.Object);

            metadataDiscovery.Process(wsdlFile, dataFile, headerFile, messageFile);

            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == wsdlFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == dataFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == headerFile)), Times.Once());
            xmlResolver.Verify(mock => mock.Resolve(It.Is <FileInfo>(v => v.FullName == messageFile)), Times.Once());
        }