Esempio n. 1
0
        public void ImageSizeValidatorShouldReturnCorrectJson(string message, int minWidth, int maxWidth, int minHeight, int maxHeight)
        {
            //Arrange
            var validator = new ImageSizeValidator(minWidth, maxWidth, minHeight, maxHeight, message);
            //Act
            var created = validator.CreateValidator();
            var json    = JsonConvert.SerializeObject(created);

            //Assert
            Assert.Equal($@"{{""assetImageDimensions"":{{""width"":{{""min"":{minWidth},""max"":{maxWidth}}},""height"":{{""min"":{minHeight},""max"":{maxHeight}}}}},""message"":""{message}""}}", json);
        }
 private EventController GetInstance(IImageService imageService = null,
                                     IMediator mediator         = null,
                                     IValidateEventEditViewModels validateEventEditViewModels = null,
                                     IUserAuthorizationService userAuthorizationService       = null,
                                     ImageSizeValidator imageSizeValidator = null
                                     )
 {
     return(new EventController(imageService ?? Mock.Of <IImageService>(),
                                mediator ?? Mock.Of <IMediator>(),
                                validateEventEditViewModels ?? Mock.Of <IValidateEventEditViewModels>(),
                                userAuthorizationService ?? Mock.Of <IUserAuthorizationService>(),
                                imageSizeValidator ?? Mock.Of <IImageSizeValidator>()));
 }