static IRecordSetCollection RecordSetCollection(IList<IDev2Definition> parsedOutput, bool isOutput, bool isDbService)
        {
            RecordSetCollectionBuilder b = new RecordSetCollectionBuilder();

            b.SetParsedOutput(parsedOutput);
            b.IsOutput = isOutput;
            b.IsDbService = isDbService;
            IRecordSetCollection result = b.Generate();

            return result;
        }
        public void RecordSetCollectionBuilder_SetParsedOutput_ParameterIsValidDefinitions_ParseOutputIsInitialisedWithParameter()
        {
            const string arguments =
                "<Outputs>" +
                   "<Output Name=\"A\" MapsTo=\"[[A]]\" Value=\"[[recA(*).A]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"B\" MapsTo=\"[[B]]\" Value=\"[[recA(*).B]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"C\" MapsTo=\"[[C]]\" Value=\"[[recB(*).C]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"D\" MapsTo=\"[[D]]\" Value=\"[[recB(*).D]]\" Recordset=\"inrecA\" />" +
                "</Outputs>";

            var defs = DataListFactory.CreateOutputParser().Parse(arguments);
            var builder = new RecordSetCollectionBuilder();
            builder.SetParsedOutput(defs);
            Assert.AreEqual(defs, builder.ParsedOutput);
        }
        public void RecordSetCollectionBuilder_Generate_OutputHasTwoRecordsetsAndIsOutputIsFalse_CollectionHasTwoRecordDefinitions()
        {
            //------------Setup for test--------------------------
            const string arguments =
                "<Outputs>" +
                   "<Output Name=\"A\" MapsTo=\"[[A]]\" Value=\"[[recA(*).A]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"B\" MapsTo=\"[[B]]\" Value=\"[[recA(*).B]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"C\" MapsTo=\"[[C]]\" Value=\"[[recB(*).C]]\" Recordset=\"inrecA\" />" +
                   "<Output Name=\"D\" MapsTo=\"[[D]]\" Value=\"[[recB(*).D]]\" Recordset=\"inrecA\" />" +
                "</Outputs>";

            var defs = DataListFactory.CreateOutputParser().Parse(arguments);
            var builder = new RecordSetCollectionBuilder();
            builder.SetParsedOutput(defs);
            builder.IsOutput = false;
            //------------Execute Test---------------------------
            var collection = builder.Generate();
            //------------Assert Results-------------------------
            Assert.IsNotNull(collection);
            Assert.AreEqual(2, collection.RecordSetNames.Count);
            Assert.AreEqual("recA", collection.RecordSetNames[0]);
            Assert.AreEqual("recB", collection.RecordSetNames[1]);
            Assert.AreEqual(2, collection.RecordSets.Count);
        }
 public void RecordSetCollectionBuilder_SetParsedOutput_ParameterOutoutIsNull_ParseOutputIsNull()
 {
     var builder = new RecordSetCollectionBuilder();
     builder.SetParsedOutput(null);
     Assert.AreEqual(0, builder.ParsedOutput.Count);
 }
 public void RecordSetCollectionBuilder_Generate_ParsedForInput_RecordsetNameIsSetFromSource()
 {
     //------------Setup for test--------------------------
     const string arguments = @"<Inputs><Input Name=""Prefix"" Source=""[[prefix(*).val]]"" /><Input Name=""Suffix"" Source=""[[prefix(*).val]]"" /></Inputs>";            
     var defs = DataListFactory.CreateInputParser().Parse(arguments);
     var builder = new RecordSetCollectionBuilder();
     builder.SetParsedOutput(defs);
     builder.IsOutput = false;
     //------------Execute Test---------------------------
     var collection = builder.Generate();
     //------------Assert Results-------------------------
     Assert.IsNotNull(collection);
     Assert.AreEqual(1, collection.RecordSetNames.Count);
     Assert.AreEqual("prefix", collection.RecordSetNames[0]);
 }
        public void RecordSetCollectionBuilder_Generate_IsOutputIsTrue_CollectionsRecordsetIsSetToRecordsetsValue()
        {
            //------------Setup for test--------------------------
            const string arguments =
                "<Outputs>" +
                   "<Output Name=\"A\" MapsTo=\"[[A]]\" Value=\"[[recA(*).A]]\" Recordset=\"Another\" />" +
                "</Outputs>";

            var defs = DataListFactory.CreateOutputParser().Parse(arguments);
            var builder = new RecordSetCollectionBuilder();
            builder.SetParsedOutput(defs);
            builder.IsOutput = true;
            //------------Execute Test---------------------------
            var collection = builder.Generate();
            //------------Assert Results-------------------------
            Assert.IsNotNull(collection);
            Assert.AreEqual(1, collection.RecordSetNames.Count);
            Assert.AreEqual("Another", collection.RecordSetNames[0]);
        }