Exemplo n.º 1
0
        public void ValidationOfSchemaWith1ValidAnd1InvalidRowsSucceedsWithoutRecusriveCheck()
        {
            var schema = new ResultSetSchema();

            schema.Columns.Add(new Column {
                Name = "Name", ClrType = typeof(string), DbType = "varchar"
            });
            schema.Columns.Add(new Column {
                ClrType = typeof(int), DbType = "int"
            });                                                                       // invalid

            Assert.IsNull(schema.Validate(false));
            Assert.IsNull(schema.Validate());
        }
Exemplo n.º 2
0
        public void CanValidateSchemaWith2ValidRows()
        {
            var schema = new ResultSetSchema();

            schema.Columns.Add(new Column {
                Name = "Name", ClrType = typeof(string), DbType = "varchar"
            });
            schema.Columns.Add(new Column {
                Name = "Length", ClrType = typeof(int), DbType = "int"
            });

            Assert.IsNull(schema.Validate(false));
            Assert.IsNull(schema.Validate(true));
        }
Exemplo n.º 3
0
        public void ValidationOfSchemaWith1ValidAnd1InvalidRowsFailsWithRecusriveCheck()
        {
            var schema = new ResultSetSchema();

            schema.Columns.Add(new Column {
                Name = "Name", ClrType = typeof(string), DbType = "varchar"
            });
            schema.Columns.Add(new Column {
                ClrType = typeof(int), DbType = "int"
            });                                                                       // invalid

            Assert.IsNull(schema.Validate(false));
            Assert.IsNull(schema.Validate());

            var ex = schema.Validate(true);

            Assert.IsNotNull(ex);
            Assert.AreSame(typeof(InvalidOperationException), ex.GetType());
            Assert.AreEqual("Schema validation failed", ex.Message);
            Assert.IsNotNull(ex.InnerException);
        }