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


C# MockLogger.ClearLog方法代码示例

本文整理汇总了C#中MockLogger.ClearLog方法的典型用法代码示例。如果您正苦于以下问题:C# MockLogger.ClearLog方法的具体用法?C# MockLogger.ClearLog怎么用?C# MockLogger.ClearLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MockLogger的用法示例。


在下文中一共展示了MockLogger.ClearLog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ItemGroupWithConditionOnGroup

        public void ItemGroupWithConditionOnGroup()
        {
            MockLogger logger = new MockLogger();
            Project p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
            @"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
            <Target Name='t'>
                <ItemGroup Condition='false'> 
                    <i1 Include='a1'/>
                    <i2 Include='b1'/>
                </ItemGroup>
                <Message Text='[@(i1)][@(i2)]'/>
            </Target>
            </Project>"))));

            p.Build(new string[] { "t" }, new ILogger[] { logger });
            logger.AssertLogDoesntContain("[a1][b1]");
            logger.ClearLog();

            p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
            @"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
            <Target Name='t'>
                <ItemGroup Condition='true'> 
                    <i1 Include='a1'/>
                    <i2 Include='b1'/>
                </ItemGroup>
                <Message Text='[@(i1)][@(i2)]'/>
            </Target>
            </Project>"))));

            p.Build(new string[] { "t" }, new ILogger[] { logger });
            logger.AssertLogContains("[a1][b1]");
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:32,代码来源:IntrinsicTask_Tests.cs

示例2: ItemAndTargetConditionsEvaluatedUsingProjectsDirectory

        public void ItemAndTargetConditionsEvaluatedUsingProjectsDirectory()
        {
            string tempFile = Path.GetTempFileName();
            string relativeTempFile = Path.GetFileName(tempFile);

            string projectFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
                    <Project xmlns=`msbuildnamespace`>
                        <ItemGroup>
                            <i Include=`i1` Condition=`exists('{0}')`/>
                        </ItemGroup>
                        <Target Name=`t` Condition=`exists('{0}')`>
                           <Message Text=`[@(i)]`/>
                        </Target>
                    </Project>
                ", relativeTempFile);

            try
            {
                MockLogger logger = new MockLogger();
                Project project = LoadAndBuildInDifferentCurrentDirectory(projectFile, logger);

                logger.AssertLogContains("[i1]");
                logger.ClearLog();

                DirtyAndBuildInDifferentCurrentDirectory(project);
                logger.AssertLogContains("[i1]");
            }
            finally
            {
                File.Delete(projectFile);
                File.Delete(tempFile);
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:33,代码来源:Project_Tests.cs

示例3: PropertyGroupWithConditionOnGroup

        public void PropertyGroupWithConditionOnGroup()
        {
            MockLogger logger = new MockLogger();
            Project p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
            @"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
            <Target Name='t'>
                <PropertyGroup Condition='false'> 
                    <p1>v1</p1>
                    <p2>v2</p2>
                </PropertyGroup>
                <Message Text='[$(P1)][$(P2)]'/>
            </Target>
            </Project>"))));

            p.Build(new string[] { "t" }, new ILogger[] { logger });
            logger.AssertLogDoesntContain("[v1][v2]");
            logger.ClearLog();

            p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
            @"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
            <Target Name='t'>
                <PropertyGroup Condition='true'> 
                    <p1>v1</p1>
                    <p2>v2</p2>
                </PropertyGroup>
                <Message Text='[$(P1)][$(P2)]'/>
            </Target>
            </Project>"))));
            p.Build(new string[] { "t" }, new ILogger[] { logger });
            logger.AssertLogContains("[v1][v2]");
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:31,代码来源:IntrinsicTask_Tests.cs

示例4: ImportConditionsEvaluatedUsingProjectsDirectory

        public void ImportConditionsEvaluatedUsingProjectsDirectory()
        {
            string importFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
                    <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                        <Target Name=`t`>
                           <Message Text=`[in import]`/>
                        </Target>
                    </Project>
                ");

            // Import the file (and express the import condition) using a *relative* path
            string importFileRelative = Path.GetFileName(importFile);

            string projectFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
                    <Project xmlns=`msbuildnamespace`>
                        <Import Project=`{0}` Condition=`exists('{0}')` />
                    </Project>
                ", importFileRelative);

            string currentDirectory = Environment.CurrentDirectory;
            try
            {
                MockLogger logger = new MockLogger();
                Project project = LoadAndBuildInDifferentCurrentDirectory(projectFile, logger);

                logger.AssertLogContains("[in import]");
                logger.ClearLog();

                DirtyAndBuildInDifferentCurrentDirectory(project);
                logger.AssertLogContains("[in import]");
            }
            finally
            {
                File.Delete(projectFile);
                File.Delete(importFile);
                Environment.CurrentDirectory = currentDirectory;
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:38,代码来源:Project_Tests.cs


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