public async Task GetHistory_AsPreserver_ShouldGetHistory() { // Arrange var tagIdUnderTest = await CreateAreaTagAsync( AreaTagType.PreArea, TwoStepJourneyWithTags.Steps.First().Id, null, true); // Act var historyDtos = await TagsControllerTestsHelper.GetHistoryAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest); // Assert Assert.IsNotNull(historyDtos); Assert.AreEqual(2, historyDtos.Count); var plannerProfile = TestFactory.Instance.GetTestProfile(UserType.Planner); // history records are sorted with newest first in list var historyDto = historyDtos.First(); Assert.IsTrue(historyDto.Description.StartsWith(EventType.PreservationStarted.GetDescription())); AssertUser(plannerProfile, historyDto.CreatedBy); historyDto = historyDtos.Last(); Assert.IsTrue(historyDto.Description.StartsWith(EventType.TagCreated.GetDescription())); AssertUser(plannerProfile, historyDto.CreatedBy); }
private async Task AssertInHistoryAsExistingEventAsync(int tagIdUnderTest, UserType userType, EventType eventType) { var historyDtos = await TagsControllerTestsHelper.GetHistoryAsync( UserType.Preserver, TestFactory.PlantWithAccess, tagIdUnderTest); // history records are sorted with newest first in list var historyDto = historyDtos.First(h => h.Description.StartsWith(eventType.GetDescription())); AssertCreatedBy(userType, historyDto); }