protected override void Before() { FakeConnectionFactory cf = new FakeConnectionFactory(); IconUploadRequest request = new IconUploadRequest(cf, WebsiteState, IconValidatorService, new FakeEmptyFileReceiver()); cf.IconInternal.Init(new Icon() { Id = EXISTING_ID, Name = EXISTING_NAME, Image = EXISTING_IMAGE, Link = EXISTING_LINK }); IconPost post = new IconPost() { Id = EXISTING_ID, Name = EXISTING_NAME, Link = NEW_LINK }; request.Process(post); newIcon = cf.IconInternal.Records.Single(); history = cf.IconHistoryInternal.Records.Single(); }
protected override void Before() { FakeConnectionFactory cf = new FakeConnectionFactory(); fileReceiver = new FakeFileReceiver(1, "Test File"); IconUploadRequest request = new IconUploadRequest(cf, WebsiteState, IconValidatorService, fileReceiver); IconPost post = new IconPost() { Id = -1, Name = "test icon", Link = LINK }; request.Process(post); newIcon = cf.IconInternal.Records.Single(); history = cf.IconHistoryInternal.Records.Single(); }
public void FailOnDuplicateName() { ExpectPortalException(() => request.Process(post), IconResult.FAIL_ALREADY_EXISTS); }
public void FailOnMissingFile() { ExpectPortalException(() => request.Process(post), IconResult.FAIL_NO_IMAGE); }
public void FailOnTooLargeFile() { ExpectPortalException(() => request.Process(post), IconResult.FAIL_DOES_NOT_EXIST); }
public void FailOnEmptyIcon() { ExpectPortalException(() => request.Process(new IconPost()), IconResult.FAIL_NO_NAME); }
public void FailOnTooLargeFile() { ExpectPortalException(() => request.Process(post), IconResult.FAIL_FILE_TOO_LARGE); }