Ejemplo n.º 1
0
 /// <inheritdoc />
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     var invoker = new FixtureMemberInvoker<IEnumerable>(factoryType, scope, factoryMethodName);
     XDocument xdocument = OpenXDocument(codeElement);
     var parameters = new object[] { GetElementList(xdocument, xPath) };
     var dataSet = new FactoryDataSet(() => invoker.Invoke(parameters), kind, columnCount);
     dataSource.AddDataSet(dataSet);
 }
Ejemplo n.º 2
0
        /// <inheritdoc />
        protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
        {
            // Create the invoker object which Gallio will call by reflection
            var invoker = new FixtureMemberInvoker<IEnumerable>(factoryType, scope, factoryMethodName);

            // Get an ADO DataTable from the implementation.
            DataTable dataTable = BuildDataTable();
            
            // Create the array of arguments which will be passed to the method called by the invoker
            var parameters = new object[] {dataTable, 
                this.RowIndexIncludeFilterArray, this.RowIndexExcludeFilterArray,
                this.CellValueIncludeFilterArray, this.CellValueExcludeFilterArray};

            // Create a FactoryDataSet with an invoker of our factory methods in the delegate 
            var dataSet = new FactoryDataSet(() => invoker.Invoke(parameters), FactoryKind.Auto, 0);
            dataSource.AddDataSet(dataSet);
        }
Ejemplo n.º 3
0
        private void CheckFactory(IEnumerable source, FactoryKind factoryKind, int columnCount, bool hasMetadata)
        {
            FactoryDataSet dataSet = new FactoryDataSet(delegate { return source; }, factoryKind, columnCount);
            DataBinding[] bindings = new DataBinding[]
            {
                new DataBinding(0, null),
                new DataBinding(1, null)
            };

            List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(bindings, true));
            Assert.Count(3, items);

            Assert.AreEqual(1, items[0].GetValue(bindings[0]));
            Assert.AreEqual(2, items[1].GetValue(bindings[0]));
            Assert.AreEqual(3, items[2].GetValue(bindings[0]));

            if (columnCount >= 2)
            {
                Assert.AreEqual("a", items[0].GetValue(bindings[1]));
                Assert.AreEqual("b", items[1].GetValue(bindings[1]));
                Assert.AreEqual("c", items[2].GetValue(bindings[1]));
            }

            if (hasMetadata)
            {
                Assert.AreEqual("1a", DataItemUtils.GetMetadata(items[0]).GetValue("Id"));
                Assert.AreEqual("2b", DataItemUtils.GetMetadata(items[1]).GetValue("Id"));
                Assert.AreEqual("3c", DataItemUtils.GetMetadata(items[2]).GetValue("Id"));
            }
        }
Ejemplo n.º 4
0
 /// <inheritdoc />
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     var invoker = new FixtureMemberInvoker<IEnumerable>(type, scope, memberName);
     var dataSet = new FactoryDataSet(() => invoker.Invoke(), kind, columnCount);
     dataSource.AddDataSet(dataSet);
 }
        /// <inheritdoc />
        protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
        {
            var invoker = new FixtureMemberInvoker<IEnumerable>(factoryType, scope, factoryMethodName);
            // Get List-of-Lists of Eleemnts
            var listOfListsOfElements = BuildListOfNodeLists(codeElement);

            // Use Gallio's invoker object to execute factory method
            var parameters = new object[] { listOfListsOfElements };
            var dataSet = new FactoryDataSet(() => invoker.Invoke(parameters), kind, columnCount);
            dataSource.AddDataSet(dataSet);
        }