internal async Task <AttachmentDto> UploadAttachmentAsync(int invitationId) { var fileToBeUploaded = TestFile.NewFileToBeUploaded(); await InvitationsControllerTestsHelper.UploadAttachmentAsync( UserType.Planner, TestFactory.PlantWithAccess, invitationId, fileToBeUploaded); var attachmentDtos = await InvitationsControllerTestsHelper.GetAttachmentsAsync( UserType.Viewer, TestFactory.PlantWithAccess, invitationId); return(attachmentDtos.Single(t => t.FileName == fileToBeUploaded.FileName)); }
public async Task UploadAttachment_AsPlanner_ShouldUploadAttachment() { // Arrange var invitationAttachments = InvitationsControllerTestsHelper.GetAttachmentsAsync( UserType.Viewer, TestFactory.PlantWithAccess, InitialMdpInvitationId); var attachmentCount = invitationAttachments.Result.Count; // Act await InvitationsControllerTestsHelper.UploadAttachmentAsync( UserType.Planner, TestFactory.PlantWithAccess, InitialMdpInvitationId, TestFile.NewFileToBeUploaded()); // Assert invitationAttachments = InvitationsControllerTestsHelper.GetAttachmentsAsync( UserType.Viewer, TestFactory.PlantWithAccess, InitialMdpInvitationId); Assert.AreEqual(attachmentCount + 1, invitationAttachments.Result.Count); }