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

            // 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 TestableRemoteAttributeBase()
            {
                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 TestableRemoteAttributeBase()
            {
                ErrorMessageResourceName = nameof(Resources.RemoteAttribute_Error),
                ErrorMessageResourceType = typeof(Resources)
            };

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

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