コード例 #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
 public void TestConstructorLogEntryEventArgs()
 {
     ILogEntry entry = new ApplicationLogEntry(MessageType.Warning, null, new object());
     LogEntryEventArgs testLogEntryEventArgs = new LogEntryEventArgs(entry);
     Assert.IsNotNull(testLogEntryEventArgs, "Constructor of type, LogEntryEventArgs failed to create instance.");
     Assert.IsNotNull(testLogEntryEventArgs.LogEntry, "Constructor of type, LogEntryEventArgs failed to create instance.");
     Assert.IsTrue(entry.Equals(testLogEntryEventArgs.LogEntry), "Constructor of type, LogEntryEventArgs failed to create instance.");
 }
コード例 #3
0
ファイル: TestLogManager.cs プロジェクト: ecell/ecell3-ide
        public void TestAppend()
        {
            ILogEntry entry = new ApplicationLogEntry(MessageType.Information, "Information", new object());
            _unitUnderTest.Append(entry);

            _unitUnderTest.LogEntryAppended += new LogEntryAppendedEventHandler(_unitUnderTest_LogEntryAppended);
            _unitUnderTest.Append(entry);
            Assert.AreEqual(entry, _unitUnderTest[0], "Count is unexpected value.");
        }
コード例 #4
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.");
        }
コード例 #5
0
ファイル: TestLogEntry.cs プロジェクト: ecell/ecell3-ide
        public void TestEquals()
        {
            ApplicationLogEntry testLogEntry = new ApplicationLogEntry(MessageType.Warning, "", new object());
            object obj = null;
            bool expectedBoolean = false;
            bool resultBoolean = false;
            resultBoolean = testLogEntry.Equals(obj);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            expectedBoolean = true;
            resultBoolean = testLogEntry.Equals(testLogEntry);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");
        }