Example #1
0
        public async void ProvinceId_Update_Valid_Reference()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

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

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

            validator.ShouldNotHaveValidationErrorFor(x => x.ProvinceId, 1);
        }
Example #2
0
        public async void AdminId_Create_Valid_Reference()
        {
            Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>();

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

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

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