Ejemplo n.º 1
0
        public async void LocationName_Update_length()
        {
            Mock <ILocationRepository> locationRepository = new Mock <ILocationRepository>();

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

            var validator = new ApiLocationServerRequestModelValidator(locationRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiLocationServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.LocationName, new string('A', 65));
        }
Ejemplo n.º 2
0
        public async void LocationName_Create_null()
        {
            Mock <ILocationRepository> locationRepository = new Mock <ILocationRepository>();

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

            var validator = new ApiLocationServerRequestModelValidator(locationRepository.Object);
            await validator.ValidateCreateAsync(new ApiLocationServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.LocationName, null as string);
        }