Exemplo n.º 1
0
        public void TestLogCustomEventNotSerializableMP()
        {
            MyCustomBuildEventArgsNotSerializable e = new MyCustomBuildEventArgsNotSerializable("testCustomBuildEvent");

            _mockHost.BuildParameters.MaxNodeCount = 4;
            _taskHost.LogCustomEvent(e);
            Assert.True(_taskHost.IsRunningMultipleNodes);
            Assert.Null(_customLogger.LastCustom as MyCustomBuildEventArgsNotSerializable); // "Expected no custom Event"

            // Make sure our custom logger received the actual custom event and not some fake.
            Assert.True(_customLogger.LastWarning is BuildWarningEventArgs); // "Expected Warning Event"
            Assert.Equal(1, _customLogger.NumberOfWarning);                  // "Expected there to be only one warning"
            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"
        }
Exemplo n.º 2
0
        public void TestLogCustomEventNotSerializableMP()
        {
            MyCustomBuildEventArgsNotSerializable e = new MyCustomBuildEventArgsNotSerializable("testCustomBuildEvent");

            _mockHost.BuildParameters.MaxNodeCount = 4;
            _taskHost.LogCustomEvent(e);
            Assert.IsTrue(_taskHost.IsRunningMultipleNodes);
            Assert.IsNull(_customLogger.LastCustom as MyCustomBuildEventArgsNotSerializable, "Expected no custom Event");

            // Make sure our custom logger received the actual custom event and not some fake.
            Assert.IsTrue(_customLogger.LastWarning is BuildWarningEventArgs, "Expected Warning Event");
            Assert.IsTrue(_customLogger.NumberOfWarning == 1, "Expected there to be only one warning");
            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");
        }