当前位置: 首页>>代码示例>>C#>>正文


C# Api.Resource类代码示例

本文整理汇总了C#中Concordion.Api.Resource的典型用法代码示例。如果您正苦于以下问题:C# Resource类的具体用法?C# Resource怎么用?C# Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Resource类属于Concordion.Api命名空间,在下文中一共展示了Resource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public RunnerResult Execute(object callingFixture, Resource resource, string href)
        {
            var runnerFixture = GetFixture(resource, href, callingFixture);

            var concordion = new ConcordionBuilder()
                                        .WithSource(Source)
                                        .WithTarget(Target)
                                        .Build();

            var results = concordion.Process(runnerFixture);

            Result result;
            if (results.HasFailures)
            {
                result = Result.Failure;
            }
            else if (results.HasExceptions)
            {
                result = Result.Exception;
            }
            else
            {
                result = Result.Success;
            }

		    return new RunnerResult(result);
        }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:27,代码来源:DefaultConcordionRunner.cs

示例2: Test_If_Paths_Are_Not_Identical_Can_Calculate_Relative_Path

        public void Test_If_Paths_Are_Not_Identical_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\spec\");
            var to = new Resource(@"\spec\blah");

            Assert.Equal<string>(@"blah", from.GetRelativePath(to));
        }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:7,代码来源:Resource_Fixture.cs

示例3: Test_If_Paths_Are_Weird_And_End_In_Slashes_Can_Calculate_Relative_Path

        public void Test_If_Paths_Are_Weird_And_End_In_Slashes_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\x\b\c\");
            var to = new Resource(@"\a\b\x\");

            Assert.Equal<string>(@"..\..\..\a\b\x\", from.GetRelativePath(to));
        }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:7,代码来源:Resource_Fixture.cs

示例4: Process

        public ProcessingResult Process(Resource resource)
        {
            var eventRecorder = new EventRecorder();
            this.Target = new StubTarget();

            var concordionBuilder = new ConcordionBuilder()
                .WithEvaluatorFactory(this.EvaluatorFactory)
                .WithSource(this.Source)
                .WithTarget(this.Target)
                .WithAssertEqualsListener(eventRecorder)
                .WithExceptionListener(eventRecorder);

            if (this.Fixture != null)
            {
                new ExtensionLoader(this.Configuration).AddExtensions(this.Fixture, concordionBuilder);
            }

            if (this.Extension != null)
            {
                this.Extension.AddTo(concordionBuilder);
            }

            var concordion = concordionBuilder.Build();

            try
            {
                IResultSummary resultSummary = concordion.Process(resource, this.Fixture);
                string xml = this.Target.GetWrittenString(resource);
                return new ProcessingResult(resultSummary, eventRecorder, xml);
            }
            catch (Exception e)
            {
                throw new Exception("Test rig failed to process specification", e);
            }
        }
开发者ID:concordion,项目名称:concordion-net,代码行数:35,代码来源:TestRig.cs

示例5: Test_If_Paths_Point_To_File_And_Are_Identical_Can_Calculate_Relative_Path

        public void Test_If_Paths_Point_To_File_And_Are_Identical_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\spec\x.html");
            var to = new Resource(@"\spec\x.html");

            Assert.Equal<string>("x.html", from.GetRelativePath(to));
        }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:7,代码来源:Resource_Fixture.cs

示例6: GenerateCommandCallTree

        private void GenerateCommandCallTree(XElement element, CommandCall parentCommandCall, Resource resource)
        {
            bool isCommandAssigned = false;

            foreach (XAttribute attribute in element.Attributes())
            {
                string namespaceURI = attribute.Name.Namespace.NamespaceName;

                if (!attribute.IsNamespaceDeclaration && !String.IsNullOrEmpty(namespaceURI))
                {
                    string commandName = attribute.Name.LocalName;
                    ICommand command = CreateCommand(namespaceURI, commandName);
                    if (command != null)
                    {
                        Check.IsFalse(isCommandAssigned, "Multiple commands per element is currently not supported.");
                        isCommandAssigned = true;
                        String expression = attribute.Value;
                        CommandCall commandCall = new CommandCall(command, new Element(element), expression, resource);
                        parentCommandCall.AddChild(commandCall);
                        parentCommandCall = commandCall;
                    }
                }
            }

            foreach (XElement child in element.Elements())
            {
                GenerateCommandCallTree(child, parentCommandCall, resource);
            }
        }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:29,代码来源:DocumentParser.cs

示例7: Process

 public IResultSummary Process(Resource resource, object fixture) 
 {
     var specification = SpecificationReader.ReadSpecification(resource);
     var resultRecorder = new SummarizingResultRecorder();
     specification.Process(EvaluatorFactory.CreateEvaluator(fixture), resultRecorder);
     return resultRecorder;
 }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:7,代码来源:Concordion.cs

示例8: AnnounceBeforeProcessingEvent

 private void AnnounceBeforeProcessingEvent(Resource resource, Element element)
 {
     foreach (var listener in m_Listeners)
     {
         listener.BeforeProcessingSpecification(new SpecificationProcessingEvent(resource, element));
     }
 }
开发者ID:concordion,项目名称:concordion-net,代码行数:7,代码来源:SpecificationCommand.cs

示例9: OnSpecificationCommandProcessed

 private void OnSpecificationCommandProcessed(Resource resource, Element element)
 {
     if (SpecificationCommandProcessed != null)
     {
         SpecificationCommandProcessed(this, new SpecificationEventArgs { Element = element, Resource = resource });
     }
 }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:7,代码来源:SpecificationCommand.cs

示例10: AddFooterToDocument

        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Results generated by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                Element dateDiv = new Element("div");
                dateDiv.AddStyleClass("testTime");
                dateDiv.AppendText("in " + (timeTaken + 1) + " ms ");
                dateDiv.AppendText(DateTime.Now.ToString());
                footer.AppendChild(dateDiv);

                body.AppendChild(footer);
            }
        }
开发者ID:Erls-Corporation,项目名称:concordion-net,代码行数:30,代码来源:PageFooterRenderer.cs

示例11: CommandCall

 public CommandCall(ICommand command, Element element, string expression, Resource resource)
 {
     Children = new CommandCallList();
     Command = command;
     Element = element;
     Expression = expression;
     Resource = resource;
 } 
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:8,代码来源:CommandCall.cs

示例12: Parse

 public ISpecification Parse(XDocument document, Resource resource)
 {
     OnDocumentParsing(document);
     XElement rootElement = document.Root;
     CommandCall rootCommandCall = new CommandCall(CreateSpecificationCommand(), new Element(rootElement), "", resource);
     GenerateCommandCallTree(rootElement, rootCommandCall, resource);
     return new XmlSpecification(rootCommandCall);
 }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:8,代码来源:DocumentParser.cs

示例13: ConcordionTest

        /// <summary>
        /// Initializes a new instance of the <see cref="ConcordionTest"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="codeElement">The code element.</param>
        /// <param name="typeInfo">The type info.</param>
        /// <param name="resource">The resource.</param>
        /// <param name="fixtureType">The fixture type.</param>
        public ConcordionTest(string name, ICodeElementInfo codeElement, ConcordionTypeInfoAdapter typeInfo, Resource resource, Type fixtureType)
            : base(name, codeElement)
        {
            if (typeInfo == null)
                throw new ArgumentNullException(@"typeInfo");

            this.TypeInfo = typeInfo;
            this.Resource = resource;
            this.FixtureType = fixtureType;
        }
开发者ID:Erls-Corporation,项目名称:concordion-net,代码行数:18,代码来源:ConcordionTest.cs

示例14: ReadSpecification

        public ISpecification ReadSpecification(Resource resource)
        {
            XDocument document;

            using (var inputStream = Source.CreateReader(resource))
            {
                document = XDocument.Load(inputStream);
            }

            return DocumentParser.Parse(document, resource);
        }
开发者ID:concordion,项目名称:concordion-net,代码行数:11,代码来源:XmlSpecificationReader.cs

示例15: CreateReader

        public TextReader CreateReader(Resource resource)
        {
            var fullyQualifiedTypeName = ConvertPathToNamespace(resource.Path);

            if (CanFind(resource))
            {
                return new StreamReader(FixtureAssembly.GetManifestResourceStream(fullyQualifiedTypeName));
            }

            throw new InvalidOperationException(String.Format("Cannot open the resource {0}", fullyQualifiedTypeName));
        }
开发者ID:numbbrain4all,项目名称:concordion-net,代码行数:11,代码来源:EmbeddedResourceSource.cs


注:本文中的Concordion.Api.Resource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。