How do I convert - noob with a potentially dumb question

Nov 21, 2012 at 5:42 PM

I have a very simple test of a validator class that I can easily unit test using the Microsoft framework.  However, due to the reporting and readability we want to use StoryQ for our test.  Unfortunately, I cannot convert this test:

public void SsnValidator_Constructor_Test()
        {
            Assert.AreEqual(Mother.ValidSsn, this._happyTarget._value, "Private member variable '_value' does not match the constructor variable.");
        }

 

Here is the corresponding class:

 

 class SsnValidator:IValidator
    {private string _value ="";

    public SsnValidator(string value)
        {
            this._value = value;
        }

        public bool IsValid()
        {
            return (
                (this._value != "") && 
                (this._value.Length==11) && 
                (HasNoLetters(this._value)) &&
                (Has2Dashes(this._value))
                );
        }

        private static bool HasNoLetters(string value)
        {
            long result;
            return long.TryParse(value.Replace("-", ""), out result);
        }

        private static bool Has2Dashes(string value)
        {
            int dashCount = 0;
            var ssnChars = value.ToCharArray();

            dashCount = ssnChars.Count(c => c == '-');


            return (dashCount == 2);
        }
    }

I realize this is a very, very simple test, but we are bringing a whole team into the TDD model and we need to keep it as simple as possible until everyone is comfortable.  Still, can someone give the StoryQ equivalent of this test?  I am not sure how to populate the .Give, .When, .Then is this scenario.

Thanks in advance.