public async Task DeleteActionAttachment_AsPreserver_ShouldDeleteActionAttachment() { // Arrange var tagIdUnderTest = TagIdUnderTest_ForStandardTagWithAttachmentsAndActionAttachments_Started; var actionsDtos = await TagsControllerTestsHelper.GetAllActionsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest); var action = actionsDtos.First(); var actionAttachmentDtos = await TagsControllerTestsHelper.GetAllActionAttachmentsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest, action.Id); var actionAttachment = actionAttachmentDtos.First(); // Act await TagsControllerTestsHelper.DeleteActionAttachmentAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest, action.Id, actionAttachment.Id, actionAttachment.RowVersion); // Assert actionAttachmentDtos = await TagsControllerTestsHelper.GetAllActionAttachmentsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest, action.Id); Assert.IsNull(actionAttachmentDtos.SingleOrDefault(m => m.Id == actionAttachment.Id)); }
public async Task GetAllActionAttachments_AsPreserver_ShouldGetAttachments() { // Arrange var tagIdUnderTest = TagIdUnderTest_ForStandardTagWithAttachmentsAndActionAttachments_Started; var actionsDtos = await TagsControllerTestsHelper.GetAllActionsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest); var action = actionsDtos.First(); // Act var attachmentDtos = await TagsControllerTestsHelper.GetAllActionAttachmentsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest, action.Id); // Assert Assert.IsNotNull(attachmentDtos); Assert.IsTrue(attachmentDtos.Count > 0); var standardTagActionAttachment = attachmentDtos.First(); Assert.IsNotNull(standardTagActionAttachment.FileName); Assert.IsNotNull(standardTagActionAttachment.RowVersion); }
public async Task GetAllActions_AsPreserver_ShouldGetActions() { // Arrange var tagIdUnderTest = TagIdUnderTest_ForStandardTagWithAttachmentsAndActionAttachments_Started; var actionIdUnderTest = await TagsControllerTestsHelper.CreateActionAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); // Act var actionDtos = await TagsControllerTestsHelper.GetAllActionsAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest); // Assert Assert.IsNotNull(actionDtos); Assert.IsTrue(actionDtos.Count > 0); var action = actionDtos.Single(a => a.Id == actionIdUnderTest); Assert.IsNotNull(action.Title); Assert.IsNotNull(action.RowVersion); }