예제 #1
0
        public void AddOptions(OptionSet options)
        {
            ArgumentUtility.CheckNotNull("options", options);

            options.Add(
                "att|attribute=",
                "Mark affected methods with custom attribute [None | Generated | Custom] (default = Generated)",
                att => _mode = (AttributeMode)Enum.Parse(typeof(AttributeMode), att));
            options.Add(
                "attPrefix=",
                "The unspeakable prefix for the virtual method. (default value: '<>virtualized_')",
                prefix => _unspeakablePrefix = prefix);
            options.Add(
                "attFullName=",
                "Fullname of the attribute type (default value: 'NonVirtualAttributeNonVirtualAttribute').",
                at => {
                _attName      = at.Substring(at.LastIndexOf(".") + 1, at.Length - at.LastIndexOf(".") - 1);
                _attNamespace = at.Substring(0, at.LastIndexOf("."));
            });
            options.Add(
                "attFile|attributeFile=",
                "Assembly containing the custom attribute (dll or exe). ONLY applicable in 'Custom' attribute mode!",
                custAtt => _attributeAssembly = custAtt);

            _selectionFactory = new TargetSelectorFactory();
            _selectionFactory.AddOptions(options);
        }
예제 #2
0
 public void SetUp()
 {
     _assemblyDefinition       = AssemblyDefinitionObjectMother.CreateMultiModuleAssemblyDefinition();
     _tracker                  = new AssemblyTracker(new [] { _assemblyDefinition }, new TypeDefinitionCache());
     _markingAttributeStrategy = MockRepository.GenerateStub <IMarkingAttributeStrategy> ();
     _codeGenerator            = MockRepository.GenerateStub <ICodeGenerator>();
     _selectionFactory         = new TargetSelectorFactory();
     _options                  = new OptionSet();
     _methodsVirtualizer       = new AssemblyMethodsVirtualizer(_markingAttributeStrategy, _selectionFactory, _codeGenerator);
 }
예제 #3
0
        public AssemblyMethodsVirtualizer(IMarkingAttributeStrategy markingAttributeStrategy,
                                          ITargetSelectionFactory targetSelectionFactory, ICodeGenerator codeGenerator)
        {
            ArgumentUtility.CheckNotNull("markingAttributeStrategy", markingAttributeStrategy);
            ArgumentUtility.CheckNotNull("targetSelectionFactory", targetSelectionFactory);
            ArgumentUtility.CheckNotNull("ilCodeGenerator", codeGenerator);

            _markingAttributeStrategy = markingAttributeStrategy;
            _selectionFactory         = targetSelectionFactory;
            _codeGenerator            = codeGenerator;
        }
        public AssemblyMethodsVirtualizer(IMarkingAttributeStrategy markingAttributeStrategy,
      ITargetSelectionFactory targetSelectionFactory, ICodeGenerator codeGenerator)
        {
            ArgumentUtility.CheckNotNull ("markingAttributeStrategy", markingAttributeStrategy);
              ArgumentUtility.CheckNotNull ("targetSelectionFactory", targetSelectionFactory);
              ArgumentUtility.CheckNotNull ("ilCodeGenerator", codeGenerator);

              _markingAttributeStrategy = markingAttributeStrategy;
              _selectionFactory = targetSelectionFactory;
              _codeGenerator = codeGenerator;
        }
        public void AddOptions(OptionSet options)
        {
            ArgumentUtility.CheckNotNull ("options", options);

              options.Add (
            "att|attribute=",
            "Mark affected methods with custom attribute [None | Generated | Custom] (default = Generated)",
            att => _mode = (AttributeMode) Enum.Parse (typeof (AttributeMode), att));
              options.Add (
            "attPrefix=",
            "The unspeakable prefix for the virtual method. (default value: '<>virtualized_')",
            prefix => _unspeakablePrefix = prefix);
              options.Add (
            "attFullName=",
            "Fullname of the attribute type (default value: 'NonVirtualAttributeNonVirtualAttribute').",
              at => {
                _attName = at.Substring (at.LastIndexOf (".") + 1, at.Length - at.LastIndexOf (".") - 1);
                _attNamespace = at.Substring (0, at.LastIndexOf ("."));
              } );
              options.Add (
            "attFile|attributeFile=",
            "Assembly containing the custom attribute (dll or exe). ONLY applicable in 'Custom' attribute mode!",
            custAtt => _attributeAssembly = custAtt);

              _selectionFactory = new TargetSelectorFactory ();
              _selectionFactory.AddOptions (options);
        }
 public void SetUp()
 {
     _assemblyDefinition = AssemblyDefinitionObjectMother.CreateMultiModuleAssemblyDefinition();
       _tracker = new AssemblyTracker (new [] { _assemblyDefinition }, new TypeDefinitionCache());
       _markingAttributeStrategy = MockRepository.GenerateStub<IMarkingAttributeStrategy> ();
       _codeGenerator = MockRepository.GenerateStub<ICodeGenerator>();
       _selectionFactory = new TargetSelectorFactory ();
       _options = new OptionSet ();
       _methodsVirtualizer = new AssemblyMethodsVirtualizer (_markingAttributeStrategy, _selectionFactory, _codeGenerator);
 }