public void CustomBuildWarningEventIsPreserved() { // Create a custom build event args that derives from MSBuild's BuildWarningEventArgs. // Set a custom field on this event (FXCopRule). MyCustomBuildWarningEventArgs fxcopWarning = new MyCustomBuildWarningEventArgs("Your code failed."); fxcopWarning.FXCopRule = "CodeViolation"; _taskHost.LogWarningEvent(fxcopWarning); // Make sure our custom logger received the actual custom event and not some fake. Assert.True(_customLogger.LastWarning is MyCustomBuildWarningEventArgs); // "Expected Custom Warning Event" // Make sure the special fields in the custom event match what we originally logged. fxcopWarning = _customLogger.LastWarning as MyCustomBuildWarningEventArgs; Assert.Equal("Your code failed.", fxcopWarning.Message); Assert.Equal("CodeViolation", fxcopWarning.FXCopRule); }
public void CustomBuildWarningEventIsPreserved() { // Create a custom build event args that derives from MSBuild's BuildWarningEventArgs. // Set a custom field on this event (FXCopRule). MyCustomBuildWarningEventArgs fxcopWarning = new MyCustomBuildWarningEventArgs("Your code failed."); fxcopWarning.FXCopRule = "CodeViolation"; _taskHost.LogWarningEvent(fxcopWarning); // Make sure our custom logger received the actual custom event and not some fake. Assert.IsTrue(_customLogger.LastWarning is MyCustomBuildWarningEventArgs, "Expected Custom Warning Event"); // Make sure the special fields in the custom event match what we originally logged. fxcopWarning = _customLogger.LastWarning as MyCustomBuildWarningEventArgs; Assert.AreEqual("Your code failed.", fxcopWarning.Message); Assert.AreEqual("CodeViolation", fxcopWarning.FXCopRule); }