public PluginRegistrationHelper(Action <string> logVerbose, Action <string> logWarning)
 {
     this.logVerbose  = logVerbose;
     this.logWarning  = logWarning;
     reflectionLoader = new ReflectionLoader();
     pluginRegistrationObjectFactory = new PluginRegistrationObjectFactory();
 }
 public PluginRegistrationHelper(Action <string> logVerbose, Action <string> logWarning,
                                 IReflectionLoader reflectionLoader, IPluginRegistrationObjectFactory pluginRegistrationObjectFactory)
 {
     this.logVerbose       = logVerbose;
     this.logWarning       = logWarning;
     this.reflectionLoader = reflectionLoader;
     this.pluginRegistrationObjectFactory = pluginRegistrationObjectFactory;
 }
        public void SetUp()
        {
            _fakeLoader        = A.Fake <IReflectionLoader>();
            _fakeObjectFactory = A.Fake <IPluginRegistrationObjectFactory>();

            A.CallTo(() => _fakeLoader.Initialise(A <string> ._, A <string> ._));
            A.CallTo(() => _fakeObjectFactory.GetAssembly(A <IReflectionLoader> ._)).Returns(new Assembly());
        }
 public PluginRegistrationHelper(IOrganizationService service, CIContext xrmContext, Action <string> logVerbose, Action <string> logWarning)
 {
     this.logVerbose                 = logVerbose;
     this.logWarning                 = logWarning;
     organizationService             = service;
     pluginRepository                = new PluginRepository(xrmContext);
     reflectionLoader                = new ReflectionLoader();
     pluginRegistrationObjectFactory = new PluginRegistrationObjectFactory();
 }
 private void SetupFakeReflectionLoader()
 {
     _fakeReflectionLoader = A.Fake <IReflectionLoader>();
     A.CallTo(() => _fakeReflectionLoader.AssemblyName).Returns("MyNameSpace.MyAssembly.dll");
     A.CallTo(() => _fakeReflectionLoader.ClassNames).Returns(new List <string>()
     {
         "TestClass1"
     });
     A.CallTo(() => _fakeReflectionLoader.Constructors).Returns(new List <Dictionary <string, object> >()
     {
         _args
     });
 }
            public static Assembly BuildAssembly(IReflectionLoader reflectionLoader)
            {
                var assembly = new Assembly
                {
                    Id            = Guid.NewGuid(),
                    Name          = reflectionLoader.AssemblyName,
                    IsolationMode = ParseEnum <PluginAssembly_IsolationMode>(reflectionLoader.Constructors.Where(
                                                                                 c => c.ContainsKey("isolationMode")).Select(c => c["isolationMode"]).First().ToString()),
                    SourceType = ParseEnum <PluginAssembly_SourceType>(reflectionLoader.Constructors.Where(
                                                                           c => c.ContainsKey("sourceType")).Select(c => c["sourceType"]).First().ToString())
                };

                var count = 0;

                foreach (var pluginConstructor in reflectionLoader.Constructors)
                {
                    assembly.PluginTypes.Add(BuildType(pluginConstructor, reflectionLoader.ClassNames[count]));
                    count++;
                }

                return(assembly);
            }
 public Assembly GetAssembly(IReflectionLoader reflectionLoader)
 {
     return(StaticPluginRegistrationObjectFactory.BuildAssembly(reflectionLoader));
 }