Exemplo n.º 1
0
        public void TestReadConfigDouble()
        {
            IConfiguration config = UnitTestHelper.GetTestConfig();

            Assert.AreEqual(2.456, Helper.ReadConfigDouble(config, "font_units"),
                            "ReadConfigDouble returns incorrect data.");
        }
Exemplo n.º 2
0
        public void TestReadConfigInt()
        {
            IConfiguration config = UnitTestHelper.GetTestConfig();

            Assert.AreEqual(9, Helper.ReadConfigInt(config, "minimum_node_height"),
                            "ReadConfigInt returns incorrect data.");
        }
Exemplo n.º 3
0
        public void TestReadConfig()
        {
            IConfiguration config = UnitTestHelper.GetTestConfig();

            Assert.AreEqual("TestOFNamespace", Helper.ReadConfig(config, "object_factory_ns", true),
                            "ReadConfig returns incorrect data.");
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            UnitTestHelper.LoadConfigManager();

            configForCtor = UnitTestHelper.GetTestConfig();
            ble           = new LayoutEngine(configForCtor);

            blept = new BaseLayoutEngineProtectedTests();

            md = UnitTestHelper.GetSampleMapData();
        }
Exemplo n.º 5
0
        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.");
            }
        }
Exemplo n.º 6
0
        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.");
            }
        }
Exemplo n.º 7
0
        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.");
            }
        }
Exemplo n.º 8
0
        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.");
            }
        }
Exemplo n.º 9
0
        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.");
            }
        }
Exemplo n.º 10
0
        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.");
            }
        }
Exemplo n.º 11
0
        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.");
            }
        }
Exemplo n.º 12
0
        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.");
            }
        }
Exemplo n.º 13
0
        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.");
            }
        }
Exemplo n.º 14
0
        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.");
            }
        }
Exemplo n.º 15
0
        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.");
            }
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
 /// <summary>
 /// A mock constructor for this test class.
 /// </summary>
 public BaseLayoutEngineProtectedTests()
     : base(UnitTestHelper.GetTestConfig())
 {
 }