public void Operator_Change_Modifier()
        {
            Operator merged1 = new Operator(controller);
            Operator merged2 = new Operator(controller);
            Operator merged3 = new Operator(controller);
            const string name = "MyOperator";
            DataType type = new DataType(controller, DataType1);
            const string expectedResult = Modifier2 + " " + DataType1 + " operator " + name;

            Operator changing = new Operator(controller, name, type, Modifier2);
            Operator unchanging = new Operator(controller, name, type, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Field_Added_Modifier()
        {
            const string name = "MyField1";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} {1} {2} {3}", Modifier1, Modifier2, type1, name);

            Field merged1 = new Field(controller);
            Field merged2 = new Field(controller);
            Field merged3 = new Field(controller);

            Field changing = new Field(controller, type1, name, Modifier1);
            changing.Modifiers.Add(Modifier2);
            Field unchanging = new Field(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void InterfaceIndexer_Add_HasNewKeyword()
        {
            InterfaceIndexer merged1 = new InterfaceIndexer(controller);
            InterfaceIndexer merged2 = new InterfaceIndexer(controller);
            InterfaceIndexer merged3 = new InterfaceIndexer(controller);

            DataType type1 = new DataType(controller, DataType1);
            const string expectedResult = "new " + DataType1 + " this []";
            InterfaceIndexer unchanging = new InterfaceIndexer(controller, type1, false);
            InterfaceIndexer changing = new InterfaceIndexer(controller, type1, true);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void InterfaceProperty_Add_HasNewKeyword()
        {
            const string name = "InterfaceProperty1";
            DataType type = new DataType(controller, DataType1);
            const string expectedResult = "new " + DataType1 + " " + name;

            InterfaceProperty merged1 = new InterfaceProperty(controller,name);
            InterfaceProperty merged2 = new InterfaceProperty(controller, name);
            InterfaceProperty merged3 = new InterfaceProperty(controller, name);

            InterfaceProperty unchanging = new InterfaceProperty(controller, name, type);
            InterfaceProperty changing = new InterfaceProperty(controller, name, type);
            changing.HasNewKeyword = true;

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Function_Changed_Modifier()
        {
            const string name = "MyFunction1";
            const string paramName = "MyParameter1";
            string expectedResult = String.Format("{0} {1} {2}", Modifier2, DataType2, name);
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            Function changing = new Function(controller, name, type2);
            changing.Parameters.Add(new Parameter(controller, DataType1, paramName));
            changing.Modifiers.Add(Modifier2);
            Function unchanging = new Function(controller, name, type1);
            unchanging.Parameters.Add(new Parameter(controller, DataType1, paramName));
            unchanging.Modifiers.Add(Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Indexer_Changed_ReturnType()
        {
            string expectedResult = String.Format("{0} this []", DataType2);
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            Indexer merged1 = new Indexer(controller);
            Indexer merged2 = new Indexer(controller);
            Indexer merged3 = new Indexer(controller);

            Indexer changing = new Indexer(controller, type2);
            Indexer unchanging = new Indexer(controller, type1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Constant_Added_Modifier()
        {
            const string constName = "MyConstName1";
            const string expresssion = "MyExpression1";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} const {1} {2} = {3}", Modifier1, DataType1, constName, expresssion);

            Constant merged1 = new Constant(controller);
            Constant merged2 = new Constant(controller);
            Constant merged3 = new Constant(controller);

            Constant changing = new Constant(controller, constName, type1, expresssion);
            changing.Modifiers.Add(Modifier1);
            Constant unchanging = new Constant(controller, constName, type1, expresssion);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Field_Changed_Return_Type()
        {
            const string name = "MyField1";
            string expectedResult = String.Format("{0} {1} {2}", Modifier1, DataType2, name);
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            Field merged1 = new Field(controller);
            Field merged2 = new Field(controller);
            Field merged3 = new Field(controller);

            Field changing = new Field(controller, type2, name, Modifier1);

            Field unchanging = new Field(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Property_Change_DataType()
        {
            Property merged1 = new Property(controller);
            Property merged2 = new Property(controller);
            Property merged3 = new Property(controller);

            const string Name = "MyProperty1";
            DataType OldDataType = new DataType(controller, DataType1);
            DataType NewDataType = new DataType(controller, DataType2);
            const string PropertyModifier = Modifier1;
            string expectedResult = PropertyModifier + " " + NewDataType + " " + Name;

            Property unchanging = new Property(controller, Name, OldDataType, PropertyModifier);
            Property changing = new Property(controller, Name, NewDataType, PropertyModifier);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Property_Change_Modifier()
        {
            Property merged1 = new Property(controller);
            Property merged2 = new Property(controller);
            Property merged3 = new Property(controller);

            const string Name = "MyProperty1";
            DataType MyDataType = new DataType(controller, DataType2);
            const string expectedResult = Modifier2 + " " + DataType2 + " " + Name;

            Property unchanging = new Property(controller, Name, MyDataType, Modifier1);
            Property changing = new Property(controller, Name, MyDataType, Modifier2);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Parameter_Change_Modifiers()
        {
            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            const string name = "MyFunction1";
            DataType dataType = new DataType(controller, DataType1);
            Parameter param = new Parameter(controller, "int", "i");
            string expectedResult = string.Format("{0} {1}({2} {3} int i)", new object[] { DataType1, name, Modifier1, Modifier2 });

            Function changing = new Function(controller, name, dataType, param);
            Function unchanging = new Function(controller, name, dataType, param);
            changing.Parameters[0].Modifiers.Add(Modifier1);
            changing.Parameters[0].Modifiers.Add(Modifier2);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Parameter_Change_IsParams()
        {
            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            const string Name = "MyFunction1";
            DataType dataType = new DataType(controller, DataType1);
            Parameter param = new Parameter(controller, "int", "i");
            string expectedResult = string.Format("{0} {1}(params int i)", new object[]{DataType1,Name});

            Function unchanging = new Function(controller, Name, dataType, param);
            Function changing = new Function(controller, Name, dataType, param);
            changing.Parameters[0].IsParams = true;

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Parameter_Add_DataType()
        {
            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            const string name = "MyFunction1";
            const string parameterName = "i";
            DataType returnType = new DataType(controller, "void");
            Parameter param = new Parameter(controller, "int", parameterName);
            string expectedResult = string.Format("void {0}({1} {2})", new object[] { name, DataType1, parameterName });

            Function unchanging = new Function(controller, name, returnType, param);
            Function changing = new Function(controller, name, returnType, new Parameter(controller, DataType1, parameterName));

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Field_Added_Preceeding_Comments()
        {
            const string name = "MyField1";
            const string comment1 = "My first comment goes here...";
            const string comment2 = "My second comment goes here...";
            const string comment3 = "My third comment goes here...";
            string expectedResult = String.Format("{0}\n{1}\n{2}".Replace("\n",Environment.NewLine),comment1,comment2,comment3);
            DataType type1 = new DataType(controller, DataType1);

            Field merged1 = new Field(controller);
            Field merged2 = new Field(controller);
            Field merged3 = new Field(controller);

            Field changing = new Field(controller, type1, name, Modifier1);
            changing.Comments.PreceedingComments.Add(comment1);
            changing.Comments.PreceedingComments.Add(comment2);
            changing.Comments.PreceedingComments.Add(comment3);
            Field unchanging = new Field(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Constant_Changed_Type_And_Expression()
        {
            const string constName = "MyConstName1";
            const string expresssion1 = "MyExpression1";
            const string expresssion2 = "MyExpression2";
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);
            string expectedResult = String.Format("const {0} {1} = {2}", DataType2, constName, expresssion2);

            Constant merged1 = new Constant(controller);
            Constant merged2 = new Constant(controller);
            Constant merged3 = new Constant(controller);

            Constant changing = new Constant(controller, constName, type2, expresssion2);
            Constant unchanging = new Constant(controller, constName, type1, expresssion1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Field_Added_Trailing_Comment()
        {
            const string name = "MyField1";
            const string comment = "My comment goes here...";
            DataType type1 = new DataType(controller, DataType1);

            Field merged1 = new Field(controller);
            Field merged2 = new Field(controller);
            Field merged3 = new Field(controller);

            Field changing = new Field(controller, type1, name, Modifier1);
            changing.Comments.TrailingComment = comment;
            Field unchanging = new Field(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, comment);
        }
        public void Delegate_Added_Modifier()
        {
            const string delegateName = "MyEnumerationName1";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} {1} delegate {2} {3}", Modifier1, Modifier2, type1, delegateName);

            Delegate merged1 = new Delegate(controller);
            Delegate merged2 = new Delegate(controller);
            Delegate merged3 = new Delegate(controller);

            Delegate changing = new Delegate(controller, delegateName, type1, Modifier1);
            changing.Modifiers.Add(Modifier2);
            Delegate unchanging = new Delegate(controller, delegateName, type1, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Function_Added_Comments()
        {
            const string name = "MyFunction1";
            const string comment = "My Comment goes here...";
            DataType type1 = new DataType(controller, DataType1);

            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            Function changing = new Function(controller, name, type1);
            Function unchanging = new Function(controller, name, type1);
            changing.Comments.PreceedingComments.Add(comment);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, comment);
        }
        public void Delegate_Changed_GenericType()
        {
            const string delegateName = "MyEnumerationName1";
            const string genericTypeName1 = "MyGenericTypeName1";
            const string genericTypeName2 = "MyGenericTypeName2";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} delegate {1} {2}<{3}>", Modifier1, type1, delegateName, genericTypeName2);

            Delegate merged1 = new Delegate(controller);
            Delegate merged2 = new Delegate(controller);
            Delegate merged3 = new Delegate(controller);

            Delegate changing = new Delegate(controller, delegateName, type1, Modifier1);
            changing.GenericType = genericTypeName2;
            Delegate unchanging = new Delegate(controller, delegateName, type1, Modifier1);
            unchanging.GenericType = genericTypeName1;

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Function_Changed_Return_Type()
        {
            const string name = "MyFunction1";
            string expectedResult = String.Format("{0} {1}", DataType2, name);
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            Function merged1 = new Function(controller);
            Function merged2 = new Function(controller);
            Function merged3 = new Function(controller);

            Function changing = new Function(controller, name, type2);
            Function unchanging = new Function(controller, name, type1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Delegate_Changed_ReturnType()
        {
            const string delegateName = "MyEnumerationName1";
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);
            string expectedResult = String.Format("{0} delegate {1} {2}", Modifier1, type2, delegateName);

            Delegate merged1 = new Delegate(controller);
            Delegate merged2 = new Delegate(controller);
            Delegate merged3 = new Delegate(controller);

            Delegate changing = new Delegate(controller, delegateName, type2, Modifier1);
            Delegate unchanging = new Delegate(controller, delegateName, type1, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void InterfaceEvent_Change_DataType()
        {
            InterfaceEvent merged1 = new InterfaceEvent(controller);
            InterfaceEvent merged2 = new InterfaceEvent(controller);
            InterfaceEvent merged3 = new InterfaceEvent(controller);

            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            const string name = "MyName1";
            const string expectedResult = "event " + DataType2 + " " + name;

            InterfaceEvent changing = new InterfaceEvent(controller, name, type2, false);
            InterfaceEvent unchanging = new InterfaceEvent(controller, name, type1, false);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Event_Added_Accessors()
        {
            const string name = "MyEvent1";
            const string addAccessorText = "{ // add accessor }";
            const string removeAccessorText = "{ // remove accessor }";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} event {1} {2}\n{{\n\tadd{3}\tremove{4}}}".Replace("\n",Environment.NewLine),Modifier1, DataType1, name, addAccessorText, removeAccessorText);

            Event merged1 = new Event(controller);
            Event merged2 = new Event(controller);
            Event merged3 = new Event(controller);

            Event changing = new Event(controller, type1, name, Modifier1);
            changing.AddAccessorText = addAccessorText;
            changing.RemoveAccessorText = removeAccessorText;
            Event unchanging = new Event(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void InterfaceIndexer_Change_DataType()
        {
            InterfaceIndexer merged1 = new InterfaceIndexer(controller);
            InterfaceIndexer merged2 = new InterfaceIndexer(controller);
            InterfaceIndexer merged3 = new InterfaceIndexer(controller);

            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            const string expectedResult = DataType2 + " this []";
            InterfaceIndexer unchanging = new InterfaceIndexer(controller, type1, false);
            InterfaceIndexer changing = new InterfaceIndexer(controller, type2, false);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Event_Changed_Modifier()
        {
            const string name = "MyEvent1";
            DataType type1 = new DataType(controller, DataType1);
            string expectedResult = String.Format("{0} event {1} {2}", Modifier2, DataType1, name);

            Event merged1 = new Event(controller);
            Event merged2 = new Event(controller);
            Event merged3 = new Event(controller);

            Event changing = new Event(controller, type1, name, Modifier2);
            Event unchanging = new Event(controller, type1, name, Modifier1);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void InterfaceProperty_Change_DataType()
        {
            const string name = "MyInterfaceProperty1";
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);
            const string expectedResult = DataType2 + " " + name;

            InterfaceProperty merged1 = new InterfaceProperty(controller, name);
            InterfaceProperty merged2 = new InterfaceProperty(controller, name);
            InterfaceProperty merged3 = new InterfaceProperty(controller, name);

            InterfaceProperty unchanging = new InterfaceProperty(controller, name, type1);
            InterfaceProperty changing = new InterfaceProperty(controller, name, type2);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }
        public void Operator_Change_DataType()
        {
            Operator merged1 = new Operator(controller);
            Operator merged2 = new Operator(controller);
            Operator merged3 = new Operator(controller);
            const string name = "MyOperator";
            const string modifier = "MyModifier";
            const string expectedResult = DataType2 + " operator " + name;
            DataType type1 = new DataType(controller, DataType1);
            DataType type2 = new DataType(controller, DataType2);

            Operator unchanging = new Operator(controller, name, type1, modifier);
            Operator changing = new Operator(controller, name, type2, modifier);

            Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult);
        }