Example #1
0
        public void EqualOperatorWhenTestSameNicknameUpperized()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("NICOLAS");

            Assert.IsTrue(nickname1 == nickname2);
        }
Example #2
0
        public void NotEqualOperatorWhenTestDifferentNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicol");

            Assert.IsTrue(nickname1 != nickname2);
        }
Example #3
0
        public void EqualWhenTestSameNicknameUpperized()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("NICOLAS");

            Assert.AreEqual(nickname1, nickname2);
        }
Example #4
0
        public void NotEqualWhenTestDifferentNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicol");

            Assert.AreNotEqual(nickname1, nickname2);
        }
Example #5
0
        public void EqualWhenTestSameNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicolas");

            Assert.AreEqual(nickname1, nickname2);
        }
Example #6
0
        public void UseRepositoryWhenUserIsDeleted()
        {
            // arrange
            var email    = Email.Parse("*****@*****.**");
            var nickName = Nickname.Parse("nickname");
            var userId   = UserId.Parse("12345");

            var mockedUserRepository = UserRepositoryBuilder.Create();

            mockedUserRepository.Users.Add((email, nickName, userId));
            var userRepository = mockedUserRepository.Build();
            var userHandler    = new UserHandler(userRepository);

            // act
            userHandler.Handle(new UserDeleted(userId));
            // assert
            Assert.AreEqual(0, mockedUserRepository.Users.Count);
        }
Example #7
0
        public void UseRepositoryWhenUserIsCreated()
        {
            // arrange
            var email       = "*****@*****.**";
            var nickName    = "nickname";
            var userId      = "12345";
            var accessToken = "accessToken";

            var mockedUserRepository = UserRepositoryBuilder.Create();
            var userRepository       = mockedUserRepository.Build();
            var userHandler          = new UserHandler(userRepository);
            // act
            var identity = Identity.Parse(email, nickName, userId, accessToken);

            userHandler.Handle(new UserCreated(identity));
            // assert
            var(actualEmail, actualNickname, actualUserId) = mockedUserRepository.Users.First();
            Assert.AreEqual(Email.Parse(email), actualEmail);
            Assert.AreEqual(Nickname.Parse(nickName), actualNickname);
            Assert.AreEqual(UserId.Parse(userId), actualUserId);
        }
Example #8
0
 public void InvalidWhenCreateNickname()
 {
     Assert.Throws <ArgumentException>(() => Nickname.Parse(string.Empty));
 }
Example #9
0
 public void ValidWhenCreateNickname()
 {
     Nickname.Parse("nicolas");
     Assert.Pass();
 }