Beispiel #1
0
        public async void Blocked_Create_length()
        {
            Mock <IFollowerRepository> followerRepository = new Mock <IFollowerRepository>();

            followerRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Follower()));

            var validator = new ApiFollowerServerRequestModelValidator(followerRepository.Object);
            await validator.ValidateCreateAsync(new ApiFollowerServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Blocked, new string('A', 2));
        }
Beispiel #2
0
        public async void FollowRequestStatu_Create_null()
        {
            Mock <IFollowerRepository> followerRepository = new Mock <IFollowerRepository>();

            followerRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Follower()));

            var validator = new ApiFollowerServerRequestModelValidator(followerRepository.Object);
            await validator.ValidateCreateAsync(new ApiFollowerServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.FollowRequestStatu, null as string);
        }
Beispiel #3
0
        public async void FollowingUserId_Create_Valid_Reference()
        {
            Mock <IFollowerRepository> followerRepository = new Mock <IFollowerRepository>();

            followerRepository.Setup(x => x.UserByFollowingUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User()));

            var validator = new ApiFollowerServerRequestModelValidator(followerRepository.Object);
            await validator.ValidateCreateAsync(new ApiFollowerServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.FollowingUserId, 1);
        }