示例#1
0
        public void ServerWrapperConstructorTest()
        {
            Console.WriteLine(Directory.GetCurrentDirectory());
            FileInfo _defaultConfig = new FileInfo(@"Plugin\DemoConfiguration\DefaultConfig.xml");

            Assert.IsTrue(_defaultConfig.Exists);
            FileInfo _oses = new FileInfo(@"Plugin\DemoConfiguration\BoilerExample.oses");

            Assert.IsTrue(_oses.Exists);
            FileInfo _uasconfig = new FileInfo(@"Plugin\DemoConfiguration\BoilerExample.uasconfig");

            Assert.IsTrue(_uasconfig.Exists);
            Assembly       _pluginAssembly;
            IConfiguration _serverConfiguration;

            AssemblyHelpers.CreateInstance(@"CAS.CommServer.UA.ConfigurationEditor.ServerConfiguration.dll", out _pluginAssembly, out _serverConfiguration);
            Assert.AreEqual <string>("CAS.UAServer.Configuration.uasconfig", _serverConfiguration.DefaultFileName);
            bool _configurationChanged = false;

            _serverConfiguration.OnModified += (x, y) => _configurationChanged = y.ConfigurationFileChanged;
            _serverConfiguration.CreateDefaultConfiguration();
            Assert.IsTrue(_configurationChanged);
            _configurationChanged = false;
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(Directory.GetCurrentDirectory());
            ServerWrapper _sw = new ServerWrapper(_serverConfiguration, _pluginAssembly, new GraphicalUserInterface(), _directory.Object, @"Plugin\DemoConfiguration\BoilerExample.uasconfig");

            Assert.IsNotNull(_sw);
            Assert.IsTrue(_configurationChanged);
        }
示例#2
0
        public void UAOOIDataBindingsTestMethod()
        {
            Assembly       _pluginAssembly      = Assembly.GetExecutingAssembly();
            IConfiguration _serverConfiguration = AssemblyHelpers.CreateInstance(_pluginAssembly);

            Assert.IsNotNull(_serverConfiguration);
            Assert.AreEqual <string>("DefaultFileName.xxl", _serverConfiguration.DefaultFileName);
            bool _configurationChanged = false;

            _serverConfiguration.OnModified += (x, y) => _configurationChanged = y.ConfigurationFileChanged;
            _serverConfiguration.CreateDefaultConfiguration();
            Assert.IsTrue(_configurationChanged);
            _configurationChanged = false;
            //TODO UANetworkingConfiguration[T].ReadConfiguration shows popup if file has errors #73
            ServerWrapper _sw = new ServerWrapper(_serverConfiguration, _pluginAssembly, new GraphicalUserInterface(), m_ConfigurationBaseFileName);

            Assert.IsNotNull(_sw);
            Assert.IsTrue(_configurationChanged);
        }