示例#1
0
        public async void Address2_Update_null()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

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

            var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiVenueServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Address2, null as string);
        }
示例#2
0
        public async void Address1_Create_length()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

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

            var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object);
            await validator.ValidateCreateAsync(new ApiVenueServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Address1, new string('A', 129));
        }
示例#3
0
        public async void ProvinceId_Update_Invalid_Reference()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

            venueRepository.Setup(x => x.ProvinceByProvinceId(It.IsAny <int>())).Returns(Task.FromResult <Province>(null));

            var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object);

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

            validator.ShouldHaveValidationErrorFor(x => x.ProvinceId, 1);
        }
示例#4
0
        public async void AdminId_Create_Invalid_Reference()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

            venueRepository.Setup(x => x.AdminByAdminId(It.IsAny <int>())).Returns(Task.FromResult <Admin>(null));

            var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object);

            await validator.ValidateCreateAsync(new ApiVenueServerRequestModel());

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