public void ErrorOnEmptyLetter() { var client = TestClient.CreateNaked(session); var user = client.Users[0]; var supplier = TestSupplier.CreateNaked(session); var from = $"{supplier.Id}@supplier.test"; PrepareSupplier(supplier, from); var message = ImapHelper.BuildMessageWithAttachments( " ", " ", new string[] { "{0}@docs.analit.net".Format(user.AvaliableAddresses[0].Id) }, new[] { from }, null); var handler = new DocSourceHandlerForTesting(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass); try { handler.CheckMime(message); Assert.Fail("Должно было возникнуть исключение MiniMailOnEmptyLetterException"); } catch (MiniMailOnEmptyLetterException exception) { Assert.That(exception.Template, Is.EqualTo(ResponseTemplate.MiniMailOnEmptyLetter)); SendErrorToProvider(handler, exception, message); } }
public void NotFoundError() { var supplier = TestSupplier.CreateNaked(session); var from = String.Format("{0}@supplier.test", supplier.Id); PrepareSupplier(supplier, from); var message = ImapHelper.BuildMessageWithAttachments( "test NotFound", "body NotFound", new string[] { "*****@*****.**" }, new[] { from }, null); var handler = new DocSourceHandlerForTesting(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass); try { handler.CheckMime(message); Assert.Fail("Должно было возникнуть исключение MiniMailOnEmptyRecipientsException"); } catch (MiniMailOnEmptyRecipientsException exception) { Assert.That(exception.Template, Is.EqualTo(ResponseTemplate.MiniMailOnEmptyRecipients)); Assert.That(exception.CauseList, Is.EqualTo("[email protected] : " + RecipientStatus.NotFound.GetDescription())); SendErrorToProvider(handler, exception, message); } }
public void ErrorOnAllowedExtensions() { var client = TestClient.CreateNaked(session); var user = client.Users[0]; var supplier = TestSupplier.CreateNaked(session); var from = String.Format("{0}@supplier.test", supplier.Id); PrepareSupplier(supplier, from); var message = ImapHelper.BuildMessageWithAttachments( "test AllowedExtensions", "body AllowedExtensions", new string[] { "{0}@docs.analit.net".Format(user.AvaliableAddresses[0].Id) }, new[] { from }, new string[] { @"..\..\Data\Waybills\70983_906384.zip" }); var handler = new DocSourceHandlerForTesting(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass); try { handler.CheckMime(message); Assert.Fail("Должно было возникнуть исключение MiniMailOnAllowedExtensionsException"); } catch (MiniMailOnAllowedExtensionsException exception) { Assert.That(exception.Template, Is.EqualTo(ResponseTemplate.MiniMailOnAllowedExtensions)); Assert.That(exception.ErrorExtention, Is.EqualTo(".zip").IgnoreCase); Assert.That(exception.AllowedExtensions, Is.EqualTo("doc, xls, gif, tiff, tif, jpg, pdf, txt").IgnoreCase); SendErrorToProvider(handler, exception, message); } }
public void NotFoundSupplierError() { var supplier = TestSupplier.CreateNaked(session); var from = String.Format("{0}@supplier.test", supplier.Id); var message = ImapHelper.BuildMessageWithAttachments( "test NotFoundSupplier", "body NotFoundSupplier", new string[] { "*****@*****.**" }, new[] { from }, null); var handler = new DocSourceHandlerForTesting(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass); try { handler.CheckMime(message); Assert.Fail("Должно было возникнуть исключение MiniMailOnUnknownProviderException"); } catch (MiniMailOnUnknownProviderException exception) { Assert.That(exception.Template, Is.EqualTo(ResponseTemplate.MiniMailOnUnknownProvider)); Assert.That(exception.SuppliersEmails, Is.StringContaining(from)); SendErrorToProvider(handler, exception, message); } }