public void Data_EmptyClass_CtorIsAdded()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "EmptyClass.xml");
            var actual = target.Data;

            Assert.AreEqual(1, actual.Count);
            Assert.IsTrue(actual.Contains(new CCDataEntry("class2", ".ctor", 1)));
        }
        public void Data_ctor_CorrectMethodName()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "ctor.xml");
            var actual = target.Data;

            Assert.AreEqual(1, actual.Count);
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", ".ctor", 1)));
        }
        public void Data_FullFile_RetrievesCorrectData()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "FullReport.xml");
            var actual = target.Data;

            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", ".ctor", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "method1", 2)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "method2", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "method2(Int32)", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "method2(Double)", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "method2(Single)", 1)));
            Assert.AreEqual(6, actual.Count);
        }
        public void Data_AnonymousType_IsParsedCorrectly()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "AnonymousType.xml");
            var actual = target.Data;

            Assert.AreEqual(6, actual.Count);
            var typename = "<>f__AnonymousType0<<Method>j__TPar,<Complexity>j__TPar>";

            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, ".ctor", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, "get_Method", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, "get_Complexity", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, "ToString", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, "Equals", 3)));
            Assert.IsTrue(actual.Contains(new CCDataEntry(typename, "GetHashCode", 1)));
        }
        public void Data_GenericMethod_CorrectNameIsParsed()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "GenericMethod.xml");
            var actual = target.Data;

            Assert.AreEqual(1, actual.Count);
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "GenericMethod<T>", 1)));
        }
 public void LoadData_InvalidFileName_throwsException()
 {
     var target = new ReflectorParser();
     target.LoadData("NoSuchFile.xml");
 }
 public void LoadData_FileFromRealUser_DoesNotCrash()
 {
     var target = new ReflectorParser();
     target.LoadData(REFLECTOR_FILE_PATH + "crap.xml");
     var actual = target.Data;
 }
        public void Data_TypeWithoutNameSpace_IsParsedCorrectly()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "NoNameSpace.xml");
            var actual = target.Data;

            Assert.AreEqual(2, actual.Count);

            Assert.IsTrue(actual.Contains(new CCDataEntry("ClassWithNoNameSpace", "StameMethod", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("ClassWithNoNameSpace", ".ctor", 1)));
        }
        public void Data_StaticMethod_IsPArsedCorrectly()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "StaticMethod.xml");
            var actual = target.Data;

            Assert.AreEqual(1, actual.Count);
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "staticMethod", 1)));
        }
        public void Data_Property_SetAndGetAreParsed()
        {
            var target = new ReflectorParser();
            target.LoadData(REFLECTOR_FILE_PATH + "Property.xml");
            var actual = target.Data;

            Assert.AreEqual(2, actual.Count);
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "get_SomeProperty", 1)));
            Assert.IsTrue(actual.Contains(new CCDataEntry("Class1", "set_SomeProperty", 1)));
        }