views:

20

answers:

1

Hello,

Why the following test does not fail?

    [TestMethod()]
    public void tip_cicluTest()
    {
        MyBO target = new MyBO() { tip_ciclu = 'S' };
        char expected = 'S';
        char actual = target.tip_ciclu;
        Assert.AreEqual(expected, actual);
        ValidationResults vr = Validation.Validate<MyBO>(target,"validare_tipciclu");
        Assert.IsTrue(vr.IsValid);
    }

where the Business Logic class is:

    [NotNullValidator(MessageTemplate = "Cannot be null!",Ruleset="validare_tipciclu")]
    [RegexValidator("^[LlMmDd]$", MessageTemplate = "Does not match!", Ruleset = "validare_ciclu")]
    public char tip_ciclu
    {
        get;
        set;
    }

So how can i check this? Using Microsoft Validation Block?

Thanks!

A: 

Non of the .net regex methods accept char, why not just use string?

Paul Creasey