I'm having some problems using IfieldChecker.
I have this following code, which I'm trying to test permitted/not permitted fields, according to my workspace
public IEnumerable<IFieldError> GetFieldErrors()
{
IFieldChecker checker = new FieldCheckerClass();
IEnumFieldError fieldErrors = null;
checker.ValidateWorkspace = this.WorkspaceHandler.GetCurrentWorkspace;
checker.Validate(this.Fields,out fieldErrors,out this._ValidatedFields);
if (fieldErrors == null)
{
yield return null;
}
else
{
fieldErrors.Reset();
IFieldError fError = fieldErrors.Next();
while (fError != null)
{
// debug only
Console.WriteLine(fError.FieldIndex.ToString());
Console.WriteLine(fError.FieldError.ToString());
yield return fError;
fError = fieldErrors.Next();
}
}
yield break;
}
Heres the test
[TestMethod]
public void FieldBuilder_TestGetFieldErrors()
{
fBuilder = new FieldBuilder(this.wHandler);
fBuilder.AddField(name, alias, esriFieldType.esriFieldTypeBlob, length, doublePrecision, doubleScale, false, false, null,
false, null);
Assert.AreEqual(2, fBuilder.GetFieldErrors().Count());
}
In my opinion, this should yield 1. The test completes, and it gives me a green light, but it should fail, since I'm testing with a bunch of values (1, 2, etc.);
The workspace I'm creating is one on C:\, therefore, should not allow a Blob field type.
Any ideas why this is working like this?
EDIT: I'm working under the premise that after setting the workspace, ArcObjects would take care of validating it and telling me which types of fields are permitted or not.
Example: FileSystemWorkspace - cannot have Blob field types;
Or, does IFieldChecker does not work the way I'm thinking?