Esempio n. 1
0
        public void IsSatisfiedBy_ThereAreInvalidChars_False()
        {
            var target    = new DeveloperMustHaveValidUsernameSpecification();
            var developer = new Developer()
            {
                Username = "******"
            };

            Assert.IsFalse(target.IsSatisfiedBy(developer));
            Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _.");

            developer.Username = "******";
            Assert.IsFalse(target.IsSatisfiedBy(developer));
            Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _.");

            developer.Username = "******";
            Assert.IsFalse(target.IsSatisfiedBy(developer));
            Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _.");
        }
Esempio n. 2
0
        public void IsSatisfiedBy_ThereAreMoreThan30Chars_False()
        {
            var target    = new DeveloperMustHaveValidUsernameSpecification();
            var developer = new Developer()
            {
                Username = "******"
            };

            Assert.IsFalse(target.IsSatisfiedBy(developer));
            Assert.AreEqual(target.NotSatisfiedReason, "Username max length is 30 chars.");
        }
Esempio n. 3
0
        public void IsSatisfiedBy_LessThan1Chars_False()
        {
            var target    = new DeveloperMustHaveValidUsernameSpecification();
            var developer = new Developer()
            {
                Username = ""
            };

            Assert.IsFalse(target.IsSatisfiedBy(developer));
            Assert.AreEqual(target.NotSatisfiedReason, "Username must have at least 1 char.");
        }
Esempio n. 4
0
        public void IsSatisfiedBy_Valid_True()
        {
            var target    = new DeveloperMustHaveValidUsernameSpecification();
            var developer = new Developer()
            {
                Username = "******"
            };

            Assert.IsTrue(target.IsSatisfiedBy(developer));

            developer.Username = "******";
            Assert.IsTrue(target.IsSatisfiedBy(developer));

            developer.Username = "******";
            Assert.IsTrue(target.IsSatisfiedBy(developer));

            developer.Username = "******";
            Assert.IsTrue(target.IsSatisfiedBy(developer));

            developer.Username = "******";
            Assert.IsTrue(target.IsSatisfiedBy(developer));
        }