示例#1
0
        public void TestCurrentContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new CustomExpression();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PARAMS", "QR a QR b" },
                { "EXPR", "(a+b)/2" },
                { "a", "60012" },
                { "b", "60013" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("2.56", str);

            Dictionary <string, string> config2 = new Dictionary <string, string>
            {
                { "PARAMS", "QR a QR b" },
                { "EXPR", "(a+b)/2" },
                { "a", "60012" },
                { "b", "60013" },
                { "SNAPSHOT", "CURRENT" }
            };
            var str2 = component.Content(reportData, config2);

            Assert.AreEqual("2.56", str2);
        }
示例#2
0
        public void TestBfContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new CustomExpression();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PARAMS", "BF a SZ b" },
                { "EXPR", "b/a" },
                { "a", "66061" },
                { "b", "10151" },
                { "FORMAT", "N0" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("10,631", str);
        }
示例#3
0
        public void TestSzContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new CustomExpression();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PARAMS", "SZ a SZ b" },
                { "EXPR", "b/a" },
                { "a", "10151" },
                { "b", "68001" },
                { "FORMAT", "N0" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("11", str);
        }