예제 #1
0
        public async void EmailValue_Create_null()
        {
            Mock <IEmailRepository> emailRepository = new Mock <IEmailRepository>();

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

            var validator = new ApiEmailServerRequestModelValidator(emailRepository.Object);
            await validator.ValidateCreateAsync(new ApiEmailServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.EmailValue, null as string);
        }
예제 #2
0
        public async void ArtistId_Create_Valid_Reference()
        {
            Mock <IEmailRepository> emailRepository = new Mock <IEmailRepository>();

            emailRepository.Setup(x => x.ArtistByArtistId(It.IsAny <int>())).Returns(Task.FromResult <Artist>(new Artist()));

            var validator = new ApiEmailServerRequestModelValidator(emailRepository.Object);
            await validator.ValidateCreateAsync(new ApiEmailServerRequestModel());

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