Exemplo n.º 1
0
        public void GetAllStatuses_ReturnsResults()
        {
            DatabaseBootstrapper.CreateAndPopulate();

            DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses");

            DatabaseBootstrapper.Drop();

            Assert.True(dataTable.Rows.Count > 0);
        }
Exemplo n.º 2
0
        public void GetAllStatuses_ReturnsResults_ThrowsOnExtraProperty()
        {
            DatabaseBootstrapper.CreateAndPopulate();

            DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses");

            DatabaseBootstrapper.Drop();

            DataTableConverter dtp = new DataTableConverter();

            dtp.DataTableParserSettings.MissingMappingHandling = MissingMappingHandling.Error;

            Assert.Throws <MissingMappingException <StatusExtraProperty> >(() => dtp.ConvertToObjectList <StatusExtraProperty>(dataTable));
        }
Exemplo n.º 3
0
        public void GetAllStatuses_ReturnsResults_CanBeParsedWithMissingFields()
        {
            DatabaseBootstrapper.CreateAndPopulate();

            DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses");

            DatabaseBootstrapper.Drop();

            DataTableConverter dtp = new DataTableConverter();

            var results = dtp.ConvertToObjectList <StatusPropertyNameMissing>(dataTable);

            Assert.Equal(dataTable.Rows.Count, results.Count());
        }
Exemplo n.º 4
0
        public void GetAllStatuses_ReturnsResults_IgnoresExtraProperty()
        {
            DatabaseBootstrapper.CreateAndPopulate();

            DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses");

            DatabaseBootstrapper.Drop();

            DataTableConverter dtp = new DataTableConverter();

            dtp.DataTableParserSettings.MissingMappingHandling = MissingMappingHandling.Ignore;

            var results = dtp.ConvertToObjectList <StatusExtraProperty>(dataTable);

            Assert.Equal(dataTable.Rows.Count, results.Count());
        }
Exemplo n.º 5
0
        public void GetAllStatuses_ReturnsResults_CanBeParsedWithCorrectObjects()
        {
            DatabaseBootstrapper.CreateAndPopulate();

            DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses");

            DatabaseBootstrapper.Drop();

            DataTableConverter dtp = new DataTableConverter();

            var results = dtp.ConvertToObjectList <StatusPropertyNamesMatch>(dataTable);

            Assert.True(results.Where(r => r.Id == (int)dataTable.Rows[0]["Id"] &&
                                      r.Description == dataTable.Rows[0]["Description"].ToString() &&
                                      r.IsPublic == (bool)dataTable.Rows[0]["IsPublic"]).Count() == 1);
        }