Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public async void FollowRequestStatu_Update_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.ValidateUpdateAsync(default(int), new ApiFollowerServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.FollowRequestStatu, null as string);
        }
Exemplo n.º 3
0
        public async void FollowingUserId_Update_Invalid_Reference()
        {
            Mock <IFollowerRepository> followerRepository = new Mock <IFollowerRepository>();

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

            var validator = new ApiFollowerServerRequestModelValidator(followerRepository.Object);

            await validator.ValidateUpdateAsync(default(int), new ApiFollowerServerRequestModel());

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