public void GetFeatured_returns_all_featured_orderedby_dateupdated_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
                }, DataSets = ds1, IsApproved = true, IsFeatured = true, DateUpdated = new DateTime(2000, 1, 1)
            };

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

            _repositoryDataSetSchema.Add(schema2);
            var schema3 = new DataSetSchema()
            {
                Category = new Category()
                {
                    Title = "categoryurl", IsDisabled = false
                }, DataSets = ds1, IsApproved = false, IsFeatured = true, DateUpdated = new DateTime(2001, 1, 1)
            };

            _repositoryDataSetSchema.Add(schema3);

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

            //assert
            Assert.AreEqual(new DateTime(1998, 1, 1), result[0].DateUpdated);
            //cleanup
            _repositoryDataSetSchema.Delete(schema1);
            _repositoryDataSetSchema.Delete(schema2);
            _repositoryDataSetSchema.Delete(schema3);
        }
        public void GetFeatured_returns_all_is_featured()
        {
            //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, IsFeatured = false
            };

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

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

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