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; }
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); }
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); }
public Attachment WithError(AttachmentErrorType errorType) { return(new Attachment(Name, Path, Length, errorType)); }