public void GetAll_returns_DatasetSchemas_orderedby_title_ascending()
        {
            //arrange
            var ds1 = new List <DataSetDetail>()
            {
                new DataSetDetail()
                {
                    DateUpdated = new DateTime(2011, 1, 1)
                }, new DataSetDetail()
                {
                    DateUpdated = new DateTime(2010, 1, 1)
                }
            };
            var schema1 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "category", IsDisabled = false
                }, Title = "btitle", DataSets = ds1, IsApproved = true
            };

            _repositoryDataSetSchema.Add(schema1);
            var schema2 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "category", IsDisabled = false
                }, Title = "atitle", DataSets = ds1, IsApproved = true
            };

            _repositoryDataSetSchema.Add(schema2);
            var ds3 = new List <DataSetDetail>()
            {
                new DataSetDetail()
                {
                    DateUpdated = new DateTime(2011, 1, 1)
                }, new DataSetDetail()
                {
                    DateUpdated = new DateTime(2010, 1, 1)
                }
            };
            var schema3 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "category", IsDisabled = false
                }, Title = "ctitle", DataSets = ds3, IsApproved = true
            };

            _repositoryDataSetSchema.Add(schema3);
            var sut = new DataSetSchemaService(_repositoryDataSetSchema, _dataSetSchemaDefinitionService,
                                               _repositoryDataSetDetail, _sqlTableUtility);
            //act
            var result = sut.GetAll();

            //assert
            Assert.AreEqual("atitle", result[0].Title);
            //cleanup
            _repositoryDataSetSchema.Delete(schema1);
            _repositoryDataSetSchema.Delete(schema2);
            _repositoryDataSetSchema.Delete(schema3);
        }
        public void GetAll_returns_DatasetSchemas_with_more_than_zero_Datasets_and_isonline()
        {
            //arrange
            var ds1 = new List <DataSetDetail>()
            {
                new DataSetDetail()
                {
                    DateUpdated = new DateTime(2011, 1, 1)
                }, new DataSetDetail()
                {
                    DateUpdated = new DateTime(2010, 1, 1)
                }
            };
            var schema1 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "categoryurl", IsDisabled = false
                }, Title = "schemaurl", DataSets = ds1, IsApproved = true
            };

            _repositoryDataSetSchema.Add(schema1);
            var schema2 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "categoryurl", IsDisabled = false
                }, Title = "schemaurl", DataSets = null, IsApproved = true
            };

            _repositoryDataSetSchema.Add(schema2);
            var ds3 = new List <DataSetDetail>()
            {
                new DataSetDetail()
                {
                    DateUpdated = new DateTime(2011, 1, 1)
                }, new DataSetDetail()
                {
                    DateUpdated = new DateTime(2010, 1, 1)
                }
            };
            var schema3 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "categoryurl", IsDisabled = false
                }, Title = "schemaurl", DataSets = ds3, IsApproved = false
            };

            _repositoryDataSetSchema.Add(schema3);
            var sut = new DataSetSchemaService(_repositoryDataSetSchema, _dataSetSchemaDefinitionService,
                                               _repositoryDataSetDetail, _sqlTableUtility);
            //act
            var result = sut.GetAll();

            //assert
            Assert.AreEqual(1, result.Count);
            //cleanup
            _repositoryDataSetSchema.Delete(schema1);
            _repositoryDataSetSchema.Delete(schema2);
            _repositoryDataSetSchema.Delete(schema3);
        }