예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            string[] args = Environment.GetCommandLineArgs();

            if (args.Length < 3)
            {
                Environment.Exit(1);
            }

            string dllName = args[1];

            if (!Path.IsPathRooted(dllName))
            {
                dllName = Path.Combine(Directory.GetCurrentDirectory(), dllName);
            }
            txtConnString.Text = args[2];

            IExtensionsFactory fact = GetFactory(dllName);

            if (fact != null)
            {
                CreatePages(fact);
            }
        }
예제 #2
0
 private IExtensionsFactory GetFactory(string dllName)
 {
     try
     {
         Assembly           asm      = Assembly.LoadFile(dllName);
         var                factType = asm.GetType("UserExt.ExtensionsFactory");
         IExtensionsFactory fact     = (IExtensionsFactory)Activator.CreateInstance(factType);
         return(fact);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cannot load tested dll: " + ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
         return(null);
     }
 }
예제 #3
0
        public void Arrange()
        {
            var hulkExtension = new Mock <IExtensionsBase>();

            hulkExtension.Setup(h => h.ExtensionName).Returns("Hulk");
            hulkExtension.Setup(h => h.IsExtensionReady).Returns(true);

            var widowExtension = new Mock <IExtensionsBase>();

            widowExtension.Setup(h => h.ExtensionName).Returns("Widow");
            widowExtension.Setup(h => h.IsExtensionReady).Returns(false);

            var extensionsFactory = new Mock <IExtensionsFactory>();

            extensionsFactory.Setup(e => e.GetExtension <WidowExtension>(It.IsAny <IServerInstance>())).Returns(widowExtension.Object);
            extensionsFactory.Setup(e => e.GetExtension <HulkExtension>(It.IsAny <IServerInstance>())).Returns(hulkExtension.Object);

            _extensionsFactory = extensionsFactory.Object;
        }
예제 #4
0
        private void CreatePages(IExtensionsFactory fact)
        {
            var vals = Enum.GetValues(typeof(EPropPage));

            foreach (var val in vals)
            {
                try
                {
                    FrameworkElement page = fact.GetPropertyPage((EPropPage)val, txtConnString.Text, CultureInfo.CurrentUICulture.Name);
                    if (page != null)
                    {
                        ListBoxItem item = new ListBoxItem();
                        item.Content = page.GetType().Name;
                        item.Tag     = page;

                        lstPages.Items.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Cannot get page for {0}: ", val) + ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
예제 #5
0
 public ServerInstance(string serverName, IExtensionsFactory extensionsFactory)
 {
     ServerName        = serverName;
     ExtensionsFactory = extensionsFactory;
 }
예제 #6
0
 public TestWorkflowService(IWorkflowApplicationFactory appFactory, IExtensionsFactory extensionsFactory) : base(appFactory, extensionsFactory)
 {
 }