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


C# BuildEventContext.Equals方法代码示例

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


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

示例1: Compare

		public void Compare ()
		{
			Assert.IsTrue (BuildEventContext.Invalid == BuildEventContext.Invalid, "#1");
			Assert.IsFalse (BuildEventContext.Invalid != BuildEventContext.Invalid, "#2");
			var inst = new BuildEventContext (0, 0, 0, 0);
			Assert.IsFalse (BuildEventContext.Invalid == inst, "#3");
			Assert.IsTrue (BuildEventContext.Invalid != inst, "#4");
			Assert.IsFalse (BuildEventContext.Invalid == null, "#5");
			Assert.IsTrue (BuildEventContext.Invalid != null, "#6");
			Assert.IsFalse (BuildEventContext.Invalid.Equals (null), "#7");
			Assert.IsFalse (BuildEventContext.Invalid.Equals (inst), "#8");
			Assert.IsTrue (BuildEventContext.Invalid.Equals (BuildEventContext.Invalid), "#9");
			Assert.IsFalse (inst.Equals (null), "#10");
			Assert.IsTrue (inst.Equals (inst), "#11");
			Assert.IsFalse (inst.Equals (BuildEventContext.Invalid), "#12");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:BuildEventContextTest.cs

示例2: ExerciseBuildEventContext

        public void ExerciseBuildEventContext()
        {
            BuildEventContext parentBuildEventContext = new BuildEventContext(0, 0, 0, 0);
            BuildEventContext currentBuildEventContext = new BuildEventContext(0, 2, 1, 1);

            BuildEventContext currentBuildEventContextNode = new BuildEventContext(1, 0, 0, 0);
            BuildEventContext currentBuildEventContextTarget = new BuildEventContext(0, 1, 0, 0);
            BuildEventContext currentBuildEventContextPci = new BuildEventContext(0, 0, 1, 0);
            BuildEventContext currentBuildEventContextTask = new BuildEventContext(0, 0, 0, 1);
            BuildEventContext allDifferent = new BuildEventContext(1, 1, 1, 1);
            BuildEventContext allSame = new BuildEventContext(0, 0, 0, 0);

            ProjectStartedEventArgs startedEvent = new ProjectStartedEventArgs(-1, "Message", "HELP", "File", "Targets", null, null, parentBuildEventContext);
            startedEvent.BuildEventContext = currentBuildEventContext;
            Assert.Equal(0, parentBuildEventContext.GetHashCode());

            // Node is different
            Assert.False(parentBuildEventContext.Equals(currentBuildEventContextNode));

            // Target is different
            Assert.False(parentBuildEventContext.Equals(currentBuildEventContextTarget));

            // PCI is different
            Assert.False(parentBuildEventContext.Equals(currentBuildEventContextPci));

            // Task is different
            Assert.False(parentBuildEventContext.Equals(currentBuildEventContextTask));

            // All fields are different
            Assert.False(parentBuildEventContext.Equals(allDifferent));

            // All fields are same
            Assert.True(parentBuildEventContext.Equals(allSame));

            // Compare with null
            Assert.False(parentBuildEventContext.Equals(null));

            // Compare with self
            Assert.True(currentBuildEventContext.Equals(currentBuildEventContext));
            Assert.False(currentBuildEventContext.Equals(new object()));
            Assert.NotNull(startedEvent.BuildEventContext);

            Assert.Equal(0, startedEvent.ParentProjectBuildEventContext.NodeId);
            Assert.Equal(0, startedEvent.ParentProjectBuildEventContext.TargetId);
            Assert.Equal(0, startedEvent.ParentProjectBuildEventContext.ProjectContextId);
            Assert.Equal(0, startedEvent.ParentProjectBuildEventContext.TaskId);
            Assert.Equal(0, startedEvent.BuildEventContext.NodeId);
            Assert.Equal(2, startedEvent.BuildEventContext.TargetId);
            Assert.Equal(1, startedEvent.BuildEventContext.ProjectContextId);
            Assert.Equal(1, startedEvent.BuildEventContext.TaskId);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:51,代码来源:EventArgs_Tests.cs


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