Ejemplo n.º 1
0
        public void FormatErrorMessage_ReturnsDefaultErrorMessage()
        {
            // Arrange
            // See ViewFeatures.Resources.RemoteAttribute_RemoteValidationFailed.
            var expected  = "'Property1' is invalid.";
            var attribute = new RemoteAttribute("Action", "Controller");

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }
Ejemplo n.º 2
0
        public void FormatErrorMessage_UsesOverriddenErrorMessage()
        {
            // Arrange
            var expected  = "Error about 'Property1' from override.";
            var attribute = new RemoteAttribute("Action", "Controller")
            {
                ErrorMessage = "Error about '{0}' from override.",
            };

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }
Ejemplo n.º 3
0
        public void FormatErrorMessage_UsesErrorMessageFromResource()
        {
            // Arrange
            var expected  = "Error about 'Property1' from resources.";
            var attribute = new RemoteAttribute("Action", "Controller")
            {
                ErrorMessageResourceName = nameof(Resources.RemoteAttribute_Error),
                ErrorMessageResourceType = typeof(Resources),
            };

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }
Ejemplo n.º 4
0
        public void FormatErrorMessage_UsesOverriddenErrorMessage()
        {
            // Arrange
            var expected = "Error about 'Property1' from override.";
            var attribute = new RemoteAttribute("Action", "Controller")
            {
                ErrorMessage = "Error about '{0}' from override.",
            };

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }
Ejemplo n.º 5
0
        public void FormatErrorMessage_UsesErrorMessageFromResource()
        {
            // Arrange
            var expected = "Error about 'Property1' from resources.";
            var attribute = new RemoteAttribute("Action", "Controller")
            {
                ErrorMessageResourceName = nameof(Resources.RemoteAttribute_Error),
                ErrorMessageResourceType = typeof(Resources),
            };

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }
Ejemplo n.º 6
0
        public void FormatErrorMessage_ReturnsDefaultErrorMessage()
        {
            // Arrange
            // See ViewFeatures.Resources.RemoteAttribute_RemoteValidationFailed.
            var expected = "'Property1' is invalid.";
            var attribute = new RemoteAttribute("Action", "Controller");

            // Act
            var message = attribute.FormatErrorMessage("Property1");

            // Assert
            Assert.Equal(expected, message);
        }