Пример #1
0
        public void CustomBuildMessageEventIsPreserved()
        {
            // Create a custom build event args that derives from MSBuild's BuildMessageEventArgs.
            // Set a custom field on this event (FXCopRule).
            MyCustomMessageEvent customMessage = new MyCustomMessageEvent("I am a message");

            customMessage.CustomMessage = "CodeViolation";

            _taskHost.LogMessageEvent(customMessage);

            // Make sure our custom logger received the actual custom event and not some fake.
            Assert.True(_customLogger.LastMessage is MyCustomMessageEvent); // "Expected Custom message Event"

            customMessage = _customLogger.LastMessage as MyCustomMessageEvent;
            Assert.Equal("I am a message", customMessage.Message);
            Assert.Equal("CodeViolation", customMessage.CustomMessage);
        }
Пример #2
0
        public void CustomBuildMessageEventIsPreserved()
        {
            // Create a custom build event args that derives from MSBuild's BuildMessageEventArgs.
            // Set a custom field on this event (FXCopRule).
            MyCustomMessageEvent customMessage = new MyCustomMessageEvent("I am a message");
            customMessage.CustomMessage = "CodeViolation";

            _taskHost.LogMessageEvent(customMessage);

            // Make sure our custom logger received the actual custom event and not some fake.
            Assert.IsTrue(_customLogger.LastMessage is MyCustomMessageEvent, "Expected Custom message Event");

            customMessage = _customLogger.LastMessage as MyCustomMessageEvent;
            Assert.AreEqual("I am a message", customMessage.Message);
            Assert.AreEqual("CodeViolation", customMessage.CustomMessage);
        }