コード例 #1
0
        public void IsUsernameAvailable_UserNull()
        {
            const string username = "******";

            var userReadRepository = new Mock <IUserReadRepository>();

            userReadRepository.Setup(r => r.Get(username, false)).Returns((User)null);
            var service = new UserAccountServiceBuilder().With(userReadRepository).Build();

            service.IsUsernameAvailable(username).Should().BeTrue();
        }
コード例 #2
0
        public void IsUsernameAvailable_ExistingUserPendingDeletion()
        {
            const string username = "******";
            var          user     = new UserBuilder(username, Guid.NewGuid()).WithStatus(UserStatuses.PendingDeletion).Build();

            var userReadRepository = new Mock <IUserReadRepository>();

            userReadRepository.Setup(r => r.Get(username, false)).Returns(user);
            var service = new UserAccountServiceBuilder().With(userReadRepository).Build();

            service.IsUsernameAvailable(username).Should().BeTrue();
        }
コード例 #3
0
        public void IsUsernameAvailable_ExistingActiveUser()
        {
            const string username = "******";
            var          user     = new UserBuilder(username, Guid.NewGuid()).Activated(true).Build();

            var userReadRepository = new Mock <IUserReadRepository>();

            userReadRepository.Setup(r => r.Get(username, false)).Returns(user);
            var service = new UserAccountServiceBuilder().With(userReadRepository).Build();

            service.IsUsernameAvailable(username).Should().BeFalse();
        }