Beispiel #1
0
        public void TestDBStatementViewFactory()
        {
            DBStatementStreamSpec spec = new DBStatementStreamSpec("s0", ViewSpec.EMPTY_VIEWSPEC_ARRAY,
                                                                   "mydb", "select * from mytesttable where mybigint=${idnum}", null);

            EventCollection eventCollection = DatabasePollingViewableFactory.CreateDBStatementView(
                "id", 1, spec,
                SupportDatabaseService.MakeService(),
                SupportEventAdapterService.Service, null, null, null, null, true);

            Assert.AreEqual(typeof(long?), eventCollection.EventType.GetPropertyType("mybigint"));
            Assert.AreEqual(typeof(string), eventCollection.EventType.GetPropertyType("myvarchar"));
            Assert.AreEqual(typeof(bool?), eventCollection.EventType.GetPropertyType("mybool"));
            Assert.AreEqual(typeof(decimal?), eventCollection.EventType.GetPropertyType("mynumeric"));
            Assert.AreEqual(typeof(decimal?), eventCollection.EventType.GetPropertyType("mydecimal"));
        }
Beispiel #2
0
        public void TestDBStatementViewFactory()
        {
            var container = SupportContainer.Instance;
            var spec      = new DBStatementStreamSpec("s0", ViewSpec.EMPTY_VIEWSPEC_ARRAY,
                                                      "mydb", "select * from mytesttable where mybigint=${idnum}", null);

            EventCollection eventCollection = DatabasePollingViewableFactory.CreateDBStatementView(
                1, 1, spec,
                SupportDatabaseService.MakeService(),
                container.Resolve <EventAdapterService>(),
                null, null, null, null, true, new DataCacheFactory(),
                SupportStatementContextFactory.MakeContext(container));

            Assert.AreEqual(typeof(long?), eventCollection.EventType.GetPropertyType("mybigint"));
            Assert.AreEqual(typeof(string), eventCollection.EventType.GetPropertyType("myvarchar"));
            Assert.AreEqual(typeof(bool?), eventCollection.EventType.GetPropertyType("mybool"));
            Assert.AreEqual(typeof(decimal?), eventCollection.EventType.GetPropertyType("mynumeric"));
            Assert.AreEqual(typeof(decimal?), eventCollection.EventType.GetPropertyType("mydecimal"));
        }