Ejemplo n.º 1
0
        public void ResolveDataSourceReturnsNullIfTheDataSourceIsNotDefinedButOthersAre()
        {
            DataSourceTable table = new DataSourceTable();
            table.DefineDataSource("someOtherSource");

            Assert.IsNull(table.ResolveDataSource("test"));
        }
Ejemplo n.º 2
0
        public void DefineDataSourceReturnsTheSameDataSourceIfAlreadyDefined()
        {
            DataSourceTable table = new DataSourceTable();
            DataSource source = table.DefineDataSource("source");

            Assert.AreSame(source, table.DefineDataSource("source"));
        }
Ejemplo n.º 3
0
        public void ResolveDataSourceReturnsADataSource()
        {
            DataSourceTable table = new DataSourceTable();

            DataSource source1 = table.DefineDataSource("source1");
            Assert.IsNotNull(source1);

            DataSource source2 = table.DefineDataSource("source2");
            Assert.IsNotNull(source2);

            Assert.AreSame(source1, table.ResolveDataSource("source1"));
            Assert.AreSame(source2, table.ResolveDataSource("source2"));
        }
        /// <summary>
        /// Defines a new data source within this data context if one does not exist.
        /// Otherwise returns the existing one.
        /// </summary>
        /// <param name="name">The data source name.</param>
        /// <returns>The defined data source.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> is null.</exception>
        public DataSource DefineDataSource(string name)
        {
            if (dataSourceTable == null)
                dataSourceTable = new DataSourceTable();

            return dataSourceTable.DefineDataSource(name);
        }
Ejemplo n.º 5
0
 public void ResolveDataSourceThrowsIfNameIsNull()
 {
     DataSourceTable table = new DataSourceTable();
     table.ResolveDataSource(null);
 }
Ejemplo n.º 6
0
 public void DefineDataSourceThrowsIfNameIsNull()
 {
     DataSourceTable table = new DataSourceTable();
     table.DefineDataSource(null);
 }
Ejemplo n.º 7
0
 public void ResolveDataSourceReturnsNullIfNoDataSourcesAreDefined()
 {
     DataSourceTable table = new DataSourceTable();
     Assert.IsNull(table.ResolveDataSource("test"));
 }