public void TestReadConfigDouble() { IConfiguration config = UnitTestHelper.GetTestConfig(); Assert.AreEqual(2.456, Helper.ReadConfigDouble(config, "font_units"), "ReadConfigDouble returns incorrect data."); }
public void TestReadConfigInt() { IConfiguration config = UnitTestHelper.GetTestConfig(); Assert.AreEqual(9, Helper.ReadConfigInt(config, "minimum_node_height"), "ReadConfigInt returns incorrect data."); }
public void TestReadConfig() { IConfiguration config = UnitTestHelper.GetTestConfig(); Assert.AreEqual("TestOFNamespace", Helper.ReadConfig(config, "object_factory_ns", true), "ReadConfig returns incorrect data."); }
public void SetUp() { UnitTestHelper.LoadConfigManager(); configForCtor = UnitTestHelper.GetTestConfig(); ble = new LayoutEngine(configForCtor); blept = new BaseLayoutEngineProtectedTests(); md = UnitTestHelper.GetSampleMapData(); }
public void TestConstructorFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("logger_name", "NoSuchLogger"); try { new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestConstructorFail4() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("graph_layouter_token", "NoSuchGraphLayouter"); try { new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ObjectSourceException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestConstructorFail3() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("object_factory_ns", "NoSuchOFNamespace"); try { new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ObjectSourceException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestMinimumUnlinkedPortSpaceFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("minimum_unlinked_port_space", "00"); try { ble = new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestMinimumSyntheticNodeHeightFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("minimum_synthetic_node_height", "00"); try { ble = new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestMinimumNodeWidthFail1() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("minimum_node_width", "12A"); try { ble = new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestCharacterUnitsFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("character_units", "0.0"); try { ble = new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestDefaultFontSizeFail1() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("default_font_size", "9.o02"); try { ble = new LayoutEngine(config); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Wrong type of exception."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Wrong type of inner exception."); } }
public void TestReadConfigIntFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("minimum_node_height", "0"); try { Helper.ReadConfigInt(config, "minimum_node_height"); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Exception thrown is of wrong type."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Inner exception is of wrong type."); } }
public void TestReadConfigFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("object_factory_ns", string.Empty); try { Helper.ReadConfig(config, "object_factory_ns", true); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Exception thrown is of wrong type."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Inner exception is of wrong type."); } }
public void TestReadConfigDoubleFail2() { IConfiguration config = UnitTestHelper.GetTestConfig(); config.SetSimpleAttribute("font_units", "0.0"); try { Helper.ReadConfigDouble(config, "font_units"); } catch (Exception e) { Assert.AreEqual(typeof(SelfDocumentingException), e.GetType(), "Exception thrown is of wrong type."); Assert.AreEqual(typeof(ConfigurationAPIException), e.InnerException.GetType(), "Inner exception is of wrong type."); } }
public void DemoTest() { //The MapData and IConfiguration come from external sources. MapData input = UnitTestHelper.GetSampleMapData(); IConfiguration config = UnitTestHelper.GetTestConfig(); //Usage is extremely simple. //create a new engine with configuration data LayoutEngine layoutEngine = new LayoutEngine(config); Console.WriteLine("MAPDATA INFO BEFORE LAYOUT:"); DisplayMapdataInfo(input); // process layout request for some data MapData ret = layoutEngine.Layout(input); Console.WriteLine("MAPDATA INFO AFTER LAYOUT:"); DisplayMapdataInfo(ret); }
/// <summary> /// A mock constructor for this test class. /// </summary> public BaseLayoutEngineProtectedTests() : base(UnitTestHelper.GetTestConfig()) { }