コード例 #1
0
        public void CanMapMultiSelectParam()
        {
            var repDefn     = this.MakeTestReportDefn();
            var choiceColl  = new CrcParameterChoiceCollection();
            var multiSelect = new CrcParameterChoice();

            multiSelect.Name   = "PretendMultiSelect";
            multiSelect.Values = new List <string>()
            {
                "M2", "M3"
            };

            choiceColl.ParameterChoiceList.Add(multiSelect);

            var mapper    = new CrcParameterChoiceMapper();
            var mapResult = mapper.MapParameterChoices(repDefn, choiceColl);

            Assert.IsTrue(mapResult.MappingValid);
            Assert.AreEqual(0, mapResult.Complaints.Count());

            var multiParamDefn = repDefn.ParameterDefinitions.FirstOrDefault(p => p.Name == "PretendMultiSelect");

            Assert.IsNotNull(multiParamDefn);
            Assert.IsNotNull(multiParamDefn.ParameterChoice);
            Assert.AreEqual(2, multiParamDefn.ParameterChoice.Values.Count());
            Assert.IsNotNull(multiParamDefn.ParameterChoice.Values.FirstOrDefault(v => v == "M2"));
            Assert.IsNotNull(multiParamDefn.ParameterChoice.Values.FirstOrDefault(v => v == "M3"));
        }
コード例 #2
0
        public void CanMapDetectWrongName()
        {
            var repDefn     = this.MakeTestReportDefn();
            var choiceColl  = new CrcParameterChoiceCollection();
            var multiSelect = new CrcParameterChoice();

            multiSelect.Name   = "WrongName";
            multiSelect.Values = new List <string>()
            {
                "M2", "M3"
            };

            choiceColl.ParameterChoiceList.Add(multiSelect);

            var mapper    = new CrcParameterChoiceMapper();
            var mapResult = mapper.MapParameterChoices(repDefn, choiceColl);

            Assert.IsFalse(mapResult.MappingValid);
            Assert.IsTrue(mapResult.Complaints.Contains("Param WrongName not found"));
        }
コード例 #3
0
        public void CanMapDateParam()
        {
            var repDefn    = this.MakeTestReportDefn();
            var choiceColl = new CrcParameterChoiceCollection();
            var dateChoice = new CrcParameterChoice();

            dateChoice.Name        = "PretendDateParam";
            dateChoice.SingleValue = "2010-06-02";
            choiceColl.ParameterChoiceList.Add(dateChoice);

            var mapper    = new CrcParameterChoiceMapper();
            var mapResult = mapper.MapParameterChoices(repDefn, choiceColl);

            Assert.IsTrue(mapResult.MappingValid);
            Assert.AreEqual(0, mapResult.Complaints.Count());

            var dateParamDefn = repDefn.ParameterDefinitions.FirstOrDefault(p => p.Name == "PretendDateParam");

            Assert.IsNotNull(dateParamDefn);
            Assert.IsNotNull(dateParamDefn.ParameterChoice);
            Assert.AreEqual("2010-06-02", dateParamDefn.ParameterChoice.SingleValue);
        }
コード例 #4
0
        public void CanMapSingleSelectParam()
        {
            var repDefn      = this.MakeTestReportDefn();
            var choiceColl   = new CrcParameterChoiceCollection();
            var singleSelect = new CrcParameterChoice();

            singleSelect.Name        = "PretendSingleSelect";
            singleSelect.SingleValue = "S2";
            choiceColl.ParameterChoiceList.Add(singleSelect);

            var mapper    = new CrcParameterChoiceMapper();
            var mapResult = mapper.MapParameterChoices(repDefn, choiceColl);

            Assert.IsTrue(mapResult.MappingValid);
            Assert.AreEqual(0, mapResult.Complaints.Count());

            var singleParamDefn = repDefn.ParameterDefinitions.FirstOrDefault(p => p.Name == "PretendSingleSelect");

            Assert.IsNotNull(singleParamDefn);
            Assert.IsNotNull(singleParamDefn.ParameterChoice);
            Assert.AreEqual("S2", singleParamDefn.ParameterChoice.SingleValue);
        }