Пример #1
0
            public static void TestDataSourceDttm()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();

                mock.m_dttmStart = DateTime.Parse("5/5/1995");
                mock.m_dttmEnd   = DateTime.Parse("5/5/1995 3:00");
                mock.m_dttmRow   = DateTime.Parse("5/5/1995 1:30");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmStart, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmEnd, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmRow, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));
            }
Пример #2
0
            public static void TestDataSourceColumn()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();

                mock.m_mpColumnValue = new Dictionary <AzLogEntry.LogColumn, string>();
                mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.String, DataSource.Column, AzLogEntry.LogColumn.AppName);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue("TestValue"), mock));
            }
Пример #3
0
        public static void TestAzLogFilterSingle()
        {
            AzLogFilter azlf = new AzLogFilter();
            TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();

            mock.m_mpColumnValue = new Dictionary <AzLogEntry.LogColumn, string>();
            mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue");

            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.String, AzLogFilterValue.DataSource.Column, AzLogEntry.LogColumn.AppName, AzLogFilterCondition.CmpOp.Eq, "TestValue"));
            Assert.AreEqual(true, azlf.FEvaluate(mock));
        }
Пример #4
0
        public static void TestAzLogFilterDateRange(string sDttmRow, AzLogFilterCondition.CmpOp cmpop1, String sCmp1, AzLogFilterCondition.CmpOp cmpop2, string sCmp2,
                                                    bool fExpected)
        {
            AzLogFilter azlf = new AzLogFilter();
            TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();

            mock.m_dttmRow = DateTime.Parse(sDttmRow);

            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop1, DateTime.Parse(sCmp1)));
            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop2, DateTime.Parse(sCmp2)));
            azlf.Add(AzLogFilterOperation.OperationType.And);

            Assert.AreEqual(fExpected, azlf.FEvaluate(mock));
        }
Пример #5
0
        public static void TestAzLogFilterDateRange(string sDttmRow, AzLogFilterCondition.CmpOp cmpop1, String sCmp1, AzLogFilterCondition.CmpOp cmpop2, string sCmp2,
            bool fExpected)
        {
            AzLogFilter azlf = new AzLogFilter();
            TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
            mock.m_dttmRow = DateTime.Parse(sDttmRow);

            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop1, DateTime.Parse(sCmp1)));
            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop2, DateTime.Parse(sCmp2)));
            azlf.Add(AzLogFilterOperation.OperationType.And);

            Assert.AreEqual(fExpected, azlf.FEvaluate(mock));
        }
Пример #6
0
            public static void TestDataSourceDttm()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
                mock.m_dttmStart = DateTime.Parse("5/5/1995");
                mock.m_dttmEnd = DateTime.Parse("5/5/1995 3:00");
                mock.m_dttmRow = DateTime.Parse("5/5/1995 1:30");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmStart, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmEnd, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmRow, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));
            }
Пример #7
0
            public static void TestDataSourceColumn()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
                mock.m_mpColumnValue = new Dictionary<AzLogEntry.LogColumn, string>();
                mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.String, DataSource.Column, AzLogEntry.LogColumn.AppName);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue("TestValue"), mock));
            }
Пример #8
0
        public static void TestAzLogFilterSingle()
        {
            AzLogFilter azlf = new AzLogFilter();
            TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
            mock.m_mpColumnValue = new Dictionary<AzLogEntry.LogColumn, string>();
            mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue");

            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.String, AzLogFilterValue.DataSource.Column, AzLogEntry.LogColumn.AppName, AzLogFilterCondition.CmpOp.Eq, "TestValue"));
            Assert.AreEqual(true, azlf.FEvaluate(mock));
        }