Example #1
0
 public void SetUp()
 {
     Ecell.MessageType type = MessageType.Information;
     string message = null;
     string group = null;
     _unitUnderTest = new CompileReport(type, message, group);
 }
Example #2
0
        public void TestConstructorReportEventArgs()
        {
            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            CompileReport report = new CompileReport(type, message, group);

            ReportEventArgs testReportEventArgs = new ReportEventArgs(report);
            Assert.IsNotNull(testReportEventArgs, "Constructor of type, ReportEventArgs failed to create instance.");
            Assert.AreEqual(report, testReportEventArgs.Report, "Report is unexpected value.");
        }
Example #3
0
        public void TestAddAndRemoveReport()
        {
            _unitUnderTest.ReportAdded += new ReportAddedEventHandler(_unitUnderTest_ReportAdded);
            _unitUnderTest.ReportRemoved += new ReportRemovedEventHandler(_unitUnderTest_ReportRemoved);
            string group = "Group";
            ReportingSession session = _unitUnderTest.GetReportingSession(group);

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            CompileReport item = new CompileReport(type, message, group);

            session.Add(item);
            session.Remove(item);
        }
Example #4
0
 public void TestConstructorCompileReport()
 {
     Ecell.MessageType type = MessageType.Error;
     string message = "Compile Error: Hoge";
     string group = "Group";
     CompileReport testCompileReport = new CompileReport(type, message, group);
     Assert.IsNotNull(testCompileReport, "Constructor of type, CompileReport failed to create instance.");
     Assert.AreEqual(MessageType.Error, testCompileReport.Type, "Type is unexpected value.");
     Assert.AreEqual(message, testCompileReport.Message, "Message is unexpected value.");
     Assert.AreEqual(group, testCompileReport.Group, "Group is unexpected value.");
     Assert.AreEqual("Compile Error", testCompileReport.Location, "Location is unexpected value.");
     Assert.AreNotEqual(0, testCompileReport.GetHashCode(), "GetHashCode method returns unexpected value.");
     Assert.IsNotNull(testCompileReport.ToString(), "ToString method returns unexpected value.");
 }
Example #5
0
        public void TestAdd()
        {
            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            CompileReport item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);
            _unitUnderTest.Add(item);

            IEnumerator<IReport> list = _unitUnderTest.GetEnumerator();
            Assert.IsTrue(_unitUnderTest.Count > 0, "Count is unexpected value.");
            Assert.AreEqual(item, _unitUnderTest[0], "Group is unexpected value.");

            try
            {
                _unitUnderTest[0] = item;
                Assert.Fail("Setter of RepportingSession must return an exception.");
            }
            catch (Exception)
            {
            }
        }
Example #6
0
        public void TestRemoveAt()
        {
            int idx = 0;

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            CompileReport item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);

            _unitUnderTest.RemoveAt(idx);

            IEnumerator<IReport> list = _unitUnderTest.GetEnumerator();
            Assert.IsTrue(_unitUnderTest.Count == 0, "Count is unexpected value.");
        }
Example #7
0
        public void TestRemove()
        {
            Ecell.Reporting.IReport item = null;
            bool expectedBoolean = false;
            bool resultBoolean = false;
            resultBoolean = _unitUnderTest.Remove(item);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Remove method returned unexpected result.");

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);

            expectedBoolean = true;
            resultBoolean = _unitUnderTest.Remove(item);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Remove method returned unexpected result.");

            IEnumerator<IReport> list = _unitUnderTest.GetEnumerator();
            Assert.IsTrue(_unitUnderTest.Count == 0, "Count is unexpected value.");
        }
Example #8
0
        public void TestIndexOf()
        {
            Ecell.Reporting.IReport item = null;
            int expectedInt32 = -1;
            int resultInt32 = 1;
            resultInt32 = _unitUnderTest.IndexOf(item);
            Assert.AreEqual(expectedInt32, resultInt32, "IndexOf method returned unexpected result.");

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);
            expectedInt32 = 0;
            resultInt32 = _unitUnderTest.IndexOf(item);
            Assert.AreEqual(expectedInt32, resultInt32, "IndexOf method returned unexpected result.");
        }
Example #9
0
        public void TestGetEnumerator()
        {
            IEnumerator<IReport> resultIEnumerator = _unitUnderTest.GetEnumerator();
            Assert.AreEqual(null, resultIEnumerator.Current, "GetEnumerator method returned unexpected result.");

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            IReport item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);

            resultIEnumerator = _unitUnderTest.GetEnumerator();
            Assert.AreEqual(null, resultIEnumerator.Current, "GetEnumerator method returned unexpected result.");
            resultIEnumerator.MoveNext();
            Assert.AreEqual(item, resultIEnumerator.Current, "GetEnumerator method returned unexpected result.");

            resultIEnumerator = (IEnumerator<IReport>)((IEnumerable)_unitUnderTest).GetEnumerator();
            Assert.AreEqual(null, resultIEnumerator.Current, "GetEnumerator method returned unexpected result.");
            resultIEnumerator.MoveNext();
            Assert.AreEqual(item, resultIEnumerator.Current, "GetEnumerator method returned unexpected result.");
        }
Example #10
0
        public void TestCopyTo()
        {
            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            IReport item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);

            IReport[] a = new IReport[1];
            int idx = 0;
            _unitUnderTest.CopyTo(a, idx);

            IEnumerator<IReport> list = _unitUnderTest.GetEnumerator();
            Assert.IsTrue(a.Length > 0, "Count is unexpected value.");
            Assert.AreEqual(item, a[0], "Group is unexpected value.");
        }
Example #11
0
        public void TestContains()
        {
            Ecell.Reporting.IReport item = null;
            bool expectedBoolean = false;
            bool resultBoolean = false;
            resultBoolean = _unitUnderTest.Contains(item);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Contains method returned unexpected result.");

            Ecell.MessageType type = MessageType.Error;
            string message = "Compile Error: Hoge";
            string group = "Group";
            item = new CompileReport(type, message, group);
            _unitUnderTest.Add(item);

            expectedBoolean = true;
            resultBoolean = _unitUnderTest.Contains(item);
            Assert.AreEqual(expectedBoolean, resultBoolean, "Contains method returned unexpected result.");
        }
Example #12
0
        public void TestEqual()
        {
            Report report = new CompileReport(MessageType.Error, "Compile Error: Hoge", "group");
            bool equal = report.Equals(report);
            Assert.AreEqual(true, equal, "Equals method returned unexpected value.");

            equal = report.Equals(null);
            Assert.AreEqual(false, equal, "Equals method returned unexpected value.");

            equal = report.Equals(new object());
            Assert.AreEqual(false, equal, "Equals method returned unexpected value.");

            //
            equal = report.Equals(new AnalysisReport(MessageType.Error, "Compile Error: Hoge", "group", "job"));
            Assert.AreEqual(true, equal, "Equals method returned unexpected value.");
        }
Example #13
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }