public void TestLogErrorEventNotSerializableMP() { MyCustomBuildErrorEventArgsNotSerializable e = new MyCustomBuildErrorEventArgsNotSerializable("SubCategory"); _mockHost.BuildParameters.MaxNodeCount = 4; Assert.True(_taskHost.IsRunningMultipleNodes); // Log the custom event args. (Pretend that the task actually did this.) _taskHost.LogErrorEvent(e); Assert.Null(_customLogger.LastError); // "Expected no error Event" Assert.True(_customLogger.LastWarning is BuildWarningEventArgs); // "Expected Warning Event" string message = ResourceUtilities.FormatResourceString("ExpectedEventToBeSerializable", e.GetType().Name); Assert.True(_customLogger.LastWarning.Message.Contains(message)); // "Expected line to contain NotSerializable message but it did not" }
public void TestLogErrorEventNotSerializableMP() { MyCustomBuildErrorEventArgsNotSerializable e = new MyCustomBuildErrorEventArgsNotSerializable("SubCategory"); _mockHost.BuildParameters.MaxNodeCount = 4; Assert.IsTrue(_taskHost.IsRunningMultipleNodes); // Log the custom event args. (Pretend that the task actually did this.) _taskHost.LogErrorEvent(e); Assert.IsNull(_customLogger.LastError, "Expected no error Event"); Assert.IsTrue(_customLogger.LastWarning is BuildWarningEventArgs, "Expected Warning Event"); string message = ResourceUtilities.FormatResourceString("ExpectedEventToBeSerializable", e.GetType().Name); Assert.IsTrue(_customLogger.LastWarning.Message.Contains(message), "Expected line to contain NotSerializable message but it did not"); }