Exemplo n.º 1
0
        private Attachment(string name, string path, long length, AttachmentErrorType errorType)
        {
            Ensure.NotEmpty(name, nameof(name));
            Ensure.NotEmpty(path, nameof(path));

            Name      = name;
            Path      = path;
            Length    = length;
            ErrorType = errorType;
        }
Exemplo n.º 2
0
        public void WithError_ShouldChange_ErrorType()
        {
            // Arrange
            const AttachmentErrorType errorType = AttachmentErrorType.FileReadError;
            var attachment = new Attachment("file1");

            // Act
            attachment = attachment.WithError(errorType);
            // Assert
            attachment.ErrorType.Should().Be(errorType);
        }
Exemplo n.º 3
0
        public void WithLength_ShouldKeep_ErrorType()
        {
            // Arrange
            const AttachmentErrorType errorType = AttachmentErrorType.TooManyFiles;
            var attachment = new Attachment("A").WithError(errorType);

            // Act
            attachment = attachment.WithLength(9876);
            // Assert
            attachment.ErrorType.Should().Be(errorType);
        }
Exemplo n.º 4
0
 public Attachment WithError(AttachmentErrorType errorType)
 {
     return(new Attachment(Name, Path, Length, errorType));
 }