.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 13th, 2003, 03:15 PM
campbel8 campbel8 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 24 campbel8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 sec
Reputation Power: 0
Developing Custom Validators

Hello!

I am attempting to create a custom validation, called LengthValidator. I have placed this class in a namespace called validators and it extends BaseValidator. I have overloaded the ControlPropertiesValid and EvaluateIsValid methods. This validator checks the length of the Text property of a TextBox object.

I have created a class to test this validator. This class simply has a main method that looks like the following:

try {
LengthValidator v = new LengthValidator();
TextBox t = new TextBox();

// Set up the text box
t.Text = "Hello";
t.MaxLength = 10;
t.ID = "txtTest";

// Set up the validator
v.MinLength = 1;
v.MaxLength = 3;
v.ControlToValidate = t.ID;

// Perform the validation
v.Validate();
Console.WriteLine(v.IsValid);
} catch (Exception a) {
Console.WriteLine(a.GetType());
}

After running this test as both an executable and a NUnit test case, I have noticed that the ControlPropertiesValid is being called, however, the EvaluateIsValid is never being called. I know this because of the beautiful Console.WriteLine statement .

Everything compiles correctly. I compile the Test class to an executable. When I run the executable, I receive the following message:
Unhandled Exception: System.IO.FileNotFoundException: File or assembly name Validators, or one of its dependencies, was not found.
File name: "Validators"
at Validators.Test.Main()

Fusion log follows:
=== Pre-bind state information ===
LOG: DisplayName = Validators, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified)
LOG: Appbase = C:\CHAD\projects\ValidatorLibrary\src\Validators\
LOG: Initial PrivatePath = NULL
Calling assembly : Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===

LOG: Application configuration file does not exist.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Validators, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/CHAD/projects/ValidatorLibrary/src/Validators/Validators.DLL.
LOG: Attempting download of new URL file:///C:/CHAD/projects/ValidatorLibrary/src/Validators/Validators/Validators.DLL.
LOG: Attempting download of new URL file:///C:/CHAD/projects/ValidatorLibrary/src/Validators/Validators.EXE.
LOG: Attempting download of new URL file:///C:/CHAD/projects/ValidatorLibrary/src/Validators/Validators/Validators.EXE.

Can someone please give me an idea of what is going on? This isn't a complicated validator, I'm just having problems testing it and I would really like to develop an NUnit testsuite for this validator. Thanks for your help, it is greatly appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Developing Custom Validators

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap