public void ServerConfigurationNullTest() { TestGraphicalUserInterface _tg = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tg, "", "", ""); Assert.IsFalse(_tg.WarningCalled); }
public void EmptyServerDescriptorTest() { TestGraphicalUserInterface _ui = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_ui, string.Empty, string.Empty, string.Empty); Assert.IsFalse(_ui.WarningCalled); }
public void ServerConfigurationWrongAssemblyTest() { TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tgi, "wrong_path", "wrong.codebase", "wrong.configuration"); Assert.IsTrue(_tgi.WarningCalled); Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase")); Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption); }
public void ServerSelectorCreatorTest() { TestGraphicalUserInterface _tg = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tg, "", "", ""); Assert.IsNull(_nss.SelectedAssembly); Assert.IsNull(_nss.ServerConfiguration); Assert.IsNull(_nss.IServerConfiguration); }
public void EmptyServerDescriptorTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.BaseDirectory).Returns(string.Empty); TestGraphicalUserInterface _ui = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_ui, _directory.Object, string.Empty, string.Empty); Assert.IsFalse(_ui.WarningCalled); }
public void ServerConfigurationNullTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.BaseDirectory).Returns(@"C:\"); TestGraphicalUserInterface _tg = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tg, _directory.Object, "", ""); Assert.IsFalse(_tg.WarningCalled); }
public void ServerConfigurationWrongAssemblyTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.BaseDirectory).Returns(@"wrong_path"); TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tgi, _directory.Object, "wrong.codebase", "wrong.configuration"); Assert.IsTrue(_tgi.WarningCalled); Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase")); Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption); }
public void ServerSelectorCreatorTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.BaseDirectory).Returns(@"C:\"); TestGraphicalUserInterface _tg = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tg, _directory.Object, "", ""); Assert.IsNull(_nss.SelectedAssembly); Assert.IsNull(_nss.ServerConfiguration); Assert.IsNull(_nss.IServerConfiguration); }
public void ServerConfigurationWTest() { TestGraphicalUserInterface _ui = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_ui, "wrong_path", "CAS.CommServer.UA.ConfigurationEditor.ServerConfiguration.dll", ""); Assert.AreEqual <int>(2, _ui.ExclamationCallCount); Assert.AreEqual <int>(0, _ui.ErrorCallCount); Assert.AreEqual <int>(0, _ui.OpenFileDialog4UnitTestAssertErrors); CollectionAssert.AreEqual(new string[] { }, _ui.ErrorCaption); CollectionAssert.AreEqual(new string[] { }, _ui.ErrorMessage); CollectionAssert.AreEqual(new string[] { "No configuration file has been selected!", "No folder is selected" }, _ui.ExclamationCaption); CollectionAssert.AreEqual(new string[] { "You did not choose the configuration file. Please select a location of the default configuration file.", "Folder is not selected, configuration will be created in the default location." }, _ui.ExclamationMessage); }
public void ConstructorWrongAssemblyTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.DefaultDirectory).Returns(Directory.GetCurrentDirectory()); TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface(); ServerSelector _nss = new ServerSelector(_tgi, _directory.Object, "wrong.codebase", "wrong.configuration"); //_nss Assert.IsNull(_nss.IServerConfiguration); Assert.IsNull(_nss.SelectedAssembly); Assert.IsNull(_nss.ServerConfiguration); //_tgi Assert.IsTrue(_tgi.WarningCalled); Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase")); Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption); }
public void PluginOkWrongConfigurationTest() { Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>(); _directory.SetupGet(x => x.DefaultDirectory).Returns(Directory.GetCurrentDirectory()); TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface(); ServerSelector _underTestItem = new ServerSelector(_tgi, _directory.Object, m_PluginFullPath, ""); //_underTestItem int _configurationChanged = 0; bool _configuration = false;; _underTestItem.OnConfigurationChanged += (x, y) => { _configurationChanged++; _configuration = y.ConfigurationFileChanged; }; Assert.IsNotNull(_underTestItem.IServerConfiguration); Assert.IsFalse(String.IsNullOrEmpty(_underTestItem.IServerConfiguration.DefaultFileName)); Assert.AreEqual <string>("CAS.UAServer.Configuration.uasconfig", _underTestItem.IServerConfiguration.DefaultFileName); Assert.IsNotNull(_underTestItem.SelectedAssembly); Assert.IsNotNull(_underTestItem.SelectedAssembly.Configuration); Assert.IsNotNull(_underTestItem.ServerConfiguration); Assert.AreEqual <string>(m_PluginFullPath, _underTestItem.ServerConfiguration.Codebase); Assert.AreEqual <string>(Path.Combine(Directory.GetCurrentDirectory(), _underTestItem.IServerConfiguration.DefaultFileName), _underTestItem.ServerConfiguration.Configuration); Assert.AreEqual <int>(0, _configurationChanged); Assert.IsFalse(_configuration); _underTestItem.IServerConfiguration.CreateDefaultConfiguration(); Assert.AreEqual <int>(2, _configurationChanged); Assert.IsTrue(_configuration); _underTestItem.IServerConfiguration.CreateDefaultConfiguration(); Assert.AreEqual <int>(4, _configurationChanged); Assert.IsTrue(_configuration); //_tgi Assert.AreEqual <int>(2, _tgi.ExclamationCallCount); Assert.AreEqual <int>(0, _tgi.ErrorCallCount); Assert.AreEqual <int>(0, _tgi.OpenFileDialog4UnitTestAssertErrors); CollectionAssert.AreEqual(new string[] { }, _tgi.ErrorCaption); CollectionAssert.AreEqual(new string[] { }, _tgi.ErrorMessage); CollectionAssert.AreEqual(new string[] { "No configuration file has been selected!", "No folder is selected" }, _tgi.ExclamationCaption); CollectionAssert.AreEqual(new string[] { "You did not choose the configuration file. Please select a location of the default configuration file.", "Folder is not selected, configuration will be created in the default location." }, _tgi.ExclamationMessage); }