コード例 #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 _.");
        }
コード例 #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.");
        }
コード例 #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.");
        }
コード例 #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));
        }