public void BaseMatchingTests()
        {
            var context = new TestContext {
                Message = new DicomFile()
            };

            SetupMultiframeXA(context.Message.DataSet, 32, 32, 2);

            var rulesEngine = new TestRulesEngine();

            var doc = new XmlDocument();

            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$StudyDescription\" pattern=\"HEART\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsTrue(context.WasApplied);

            rulesEngine        = new TestRulesEngine();
            context.WasApplied = false;
            doc = new XmlDocument();
            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$StudyDescription\" pattern=\"HEART22\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsFalse(context.WasApplied);

            rulesEngine        = new TestRulesEngine();
            context.WasApplied = false;
            doc = new XmlDocument();
            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$StudyDescription\" pattern=\"FAIL\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsFalse(context.WasApplied);
        }
        public void SequenceMatchingTests()
        {
            var context = new TestContext {
                Message = new DicomFile()
            };

            SetupMultiframeXA(context.Message.DataSet, 64, 64, 5);

            var rulesEngine = new TestRulesEngine();

            var doc = new XmlDocument();

            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$RequestAttributesSequence/$RequestedProcedureId\" pattern=\"XA123\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsTrue(context.WasApplied);

            doc = new XmlDocument();
            context.WasApplied = false;
            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$RequestAttributesSequence/$ScheduledProcedureStepId\" pattern=\"XA1234\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsTrue(context.WasApplied);

            doc = new XmlDocument();
            context.WasApplied = false;
            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$RequestAttributesSequence/$ScheduledProcedureStepId\" pattern=\"XA5678\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsTrue(context.WasApplied);

            doc = new XmlDocument();
            context.WasApplied = false;
            doc.LoadXml("<rule expressionLanguage=\"dicom\" ><condition><regex test=\"$RequestAttributesSequence/$ScheduledProcedureStepId\" pattern=\"FAIL\" /></condition><action><test/></action></rule>");
            rulesEngine.Load(doc, TestEnum.Test1);
            rulesEngine.Execute(context);
            Assert.IsFalse(context.WasApplied);
        }