コード例 #1
0
ファイル: TestLogEntry.cs プロジェクト: ecell/ecell3-ide
        public void TestConstructorLogEntryTypeMessage()
        {
            string expectedMessage = "";
            MessageType expectedType = MessageType.Warning;
            DateTime expectedTimestamp = DateTime.Now;
            ApplicationLogEntry testLogEntry = new ApplicationLogEntry(MessageType.Warning, null, new object());
            Assert.IsNotNull(testLogEntry, "Constructor of type, LogEntry failed to create instance.");
            Assert.AreEqual(expectedType, testLogEntry.Type, "Type is unexpected value.");
            Assert.AreEqual(expectedMessage, testLogEntry.Message, "Message is unexpected value.");
            Assert.AreEqual(expectedTimestamp, testLogEntry.Timestamp, "Timestamp is unexpected value.");
            Assert.AreEqual("Object", testLogEntry.Location, "Location is unexpected value.");
            Assert.IsNotNull(testLogEntry.GetHashCode(), "GetHashCode method returned unexpected value.");
            Assert.IsNotNull(testLogEntry.ToString(), "GetHashCode method returned unexpected value.");

            expectedMessage = "Information.";
            expectedType = MessageType.Information;
            expectedTimestamp = DateTime.Now;
            testLogEntry = new ApplicationLogEntry(MessageType.Information, "Information.", new object());
            Assert.IsNotNull(testLogEntry, "Constructor of type, LogEntry failed to create instance.");
            Assert.AreEqual(expectedType, testLogEntry.Type, "Type is unexpected value.");
            Assert.AreEqual(expectedMessage, testLogEntry.Message, "Message is unexpected value.");
            Assert.AreEqual(expectedTimestamp, testLogEntry.Timestamp, "Timestamp is unexpected value.");
            Assert.AreEqual("Object", testLogEntry.Location, "Location is unexpected value.");
            Assert.IsNotNull(testLogEntry.GetHashCode(), "GetHashCode method returned unexpected value.");
            Assert.IsNotNull(testLogEntry.ToString(), "GetHashCode method returned unexpected value.");
        }
コード例 #2
0
ファイル: TestLogEntry.cs プロジェクト: ecell/ecell3-ide
        public void TestGetHashCode()
        {
            ApplicationLogEntry testLogEntry1 = new ApplicationLogEntry(MessageType.Warning, "", new object());
            ApplicationLogEntry testLogEntry2 = new ApplicationLogEntry(MessageType.Warning, "", new object());

            int expectedInt32 = testLogEntry1.GetHashCode();
            int resultInt32 = testLogEntry2.GetHashCode();
            Assert.AreEqual(expectedInt32, resultInt32, "GetHashCode method returned unexpected result.");

            resultInt32 = _unitUnderTest.GetHashCode();
            Assert.AreNotEqual(expectedInt32, resultInt32, "GetHashCode method returned unexpected result.");
        }