Пример #1
0
        public void File_DefaultError_ReturnsDefaultErrorMessage()
        {
            var name = "File";

            var sut = new FileAttribute(new[] { FileType.Doc });

            var errorMessage = sut.FormatErrorMessage(name);

            Assert.AreEqual(string.Format(DataAnnotationsResources.FileAttribute_Invalid, name), errorMessage);
        }
Пример #2
0
        public void File_ErrorResource_ReturnsErrorResource()
        {
            var name = "File";
            var sut  = new FileAttribute(new[] { FileType.Doc })
            {
                ErrorMessageResourceName = "FileAttribute_InvalidFileModels", ErrorMessageResourceType = typeof(DataAnnotationsResources)
            };

            var errorMessage = sut.FormatErrorMessage(name);

            Assert.AreEqual(string.Format(DataAnnotationsResources.FileAttribute_InvalidFileModels, name), errorMessage);
        }
Пример #3
0
        public void File_ErrorMessage_ReturnsErrorMessage()
        {
            var errorMessageFormat = "My error";
            var sut = new FileAttribute(new[] { FileType.Doc })
            {
                ErrorMessage = errorMessageFormat
            };

            var errorMessage = sut.FormatErrorMessage(string.Empty);

            Assert.AreEqual(errorMessageFormat, errorMessage);
        }