Beispiel #1
0
        public void OldConfigXml()
        {
            string json = Resources.old_config1;
            ConfigurationsReader reader = this.resolver.Create <ConfigurationsReader>();

            Assert.ThrowsException <InvalidConfigurationException>(() => reader.Parse(json));
        }
Beispiel #2
0
        public void EmptyGenerate()
        {
            ConfigurationsReader    reader         = this.resolver.Create <ConfigurationsReader>();
            List <ConfigurationSet> configurations = reader.Parse(Resources.empty_generate);

            Assert.AreEqual(1, configurations.Count, "Unexpected number of configurations");
            Assert.AreEqual(0, configurations[0].Readers.Count, "Unexpected number of readers");
            Assert.AreEqual(0, configurations[0].Writers.Count, "Unexpected number of writers");
        }
Beispiel #3
0
        public void OneGenerateInArrayArray()
        {
            ConfigurationsReader    reader         = this.resolver.Create <ConfigurationsReader>();
            List <ConfigurationSet> configurations = reader.Parse(Resources.one_generate_in_array_array);

            Assert.AreEqual(1, configurations.Count, "Unexpected number of configurations");
            Assert.AreEqual(0, configurations[0].Readers.Count, "Unexpected number of readers");
            Assert.AreEqual(1, configurations[0].Writers.Count, "Unexpected number of writers");
            Assert.AreEqual("Test1", configurations[0].Writers[0].CastTo <Write1Configuration>().Property1);
        }
Beispiel #4
0
        public void TwoReadsOneGenerate()
        {
            ConfigurationsReader    reader         = this.resolver.Create <ConfigurationsReader>();
            List <ConfigurationSet> configurations = reader.Parse(Resources.two_reads_one_generate);

            Assert.AreEqual(1, configurations.Count, "Unexpected number of configurations");
            Assert.AreEqual(2, configurations[0].Readers.Count, "Unexpected number of readers");
            Assert.AreEqual(1, configurations[0].Writers.Count, "Unexpected number of writers");
            Assert.AreEqual("Test1", configurations[0].Readers[0].CastTo <Read1Configuration>().Property1);
            Assert.AreEqual("Test2", configurations[0].Readers[1].CastTo <Read2Configuration>().Property2);
            Assert.AreEqual("Test3", configurations[0].Writers[0].CastTo <Write1Configuration>().Property1);
        }
Beispiel #5
0
        private List <ConfigurationSet> Deserialize(string configuration)
        {
            ConfigurationsReader configurationsReader = this.resolver.Create <ConfigurationsReader>();

            return(configurationsReader.Parse(configuration));
        }
Beispiel #6
0
        public void EmptyConfiguration()
        {
            ConfigurationsReader reader = this.resolver.Create <ConfigurationsReader>();

            Assert.ThrowsException <InvalidConfigurationException>(() => reader.Parse(Resources.empty_configuration));
        }