public async Task Migrate_ParitallyMigratedItemsUpdated_Succeeds() { // Arrange int numberOfWorkItems = 5; var reader = new CodePlexReaderMock(); var destManager = new Mock <IWorkItemDestination>(); var logger = new Mock <ILogger>(); reader.BuildWorkItemLists(numberOfWorkItems); var partiallyMigratedItems = new List <MigratedWorkItem>(); foreach (WorkItemSummary summary in reader.Summaries) { var status = new MigratedWorkItem(summary.Id, MigrationState.PartiallyMigrated); partiallyMigratedItems.Add(status); } destManager.Setup(m => m.GetMigratedWorkItemsAsync()).ReturnsAsync(partiallyMigratedItems); // Act await WorkItemMigrator.MigrateAsync(reader.mockReader.Object, destManager.Object, MigrationSettings.DefaultSettings, logger.Object); //Assert reader.VerifyReaderCalledForWorkItems(); destManager.Verify(m => m.WriteWorkItemAsync(It.IsAny <WorkItemDetails>()), Times.Never); destManager.Verify(m => m.UpdateWorkItemAsync(It.IsAny <WorkItemDetails>()), Times.Exactly(numberOfWorkItems)); }
public async Task Migrate_ZeroItemsToMigrate_Succeeds() { // Arrange var reader = new CodePlexReaderMock(); var destManager = new Mock <IWorkItemDestination>(); var logger = new Mock <ILogger>(); reader.BuildWorkItemLists(0); // Act await WorkItemMigrator.MigrateAsync(reader.mockReader.Object, destManager.Object, MigrationSettings.DefaultSettings, logger.Object); //Assert reader.VerifyReaderCalledForWorkItems(); destManager.Verify(m => m.WriteWorkItemAsync(It.IsAny <WorkItemDetails>()), Times.Never); destManager.Verify(m => m.UpdateWorkItemAsync(It.IsAny <WorkItemDetails>()), Times.Never); }