/// <summary> /// Create and return a new <see cref="DocumentMetadataManager"/>, /// configured with the properties available in this builder instance /// </summary> /// <returns> /// A new <see cref="DocumentMetadataManager"/> for use in unit tests /// </returns> public DocumentMetadataManager CreateDocumentMetadataManager() { if (DocumentMetadataFactory == null) { var builder = new DocumentMetadataFactoryBuilder(TimeProviderMock); DocumentMetadataFactory = builder.CreateDocumentMetadataFactory(true); } if (UserPreferences == null) { UserPreferences = UserPreferencesBuilder.CreateUserPreferences(); } if (UpdateReactionMapping == null) { var displayNameHighlightEvaluator = new DisplayNameHighlightEvaluator(); var filePathService = new FilePathService(); var updateReactions = new IUpdateReaction[] { new AssignProjectColoursReaction(Mock.Of <IProjectBrushService>()), new GroupByProjectReaction(), new PathSegmentCountReaction(displayNameHighlightEvaluator, filePathService), new SelectedSortOptionReaction(SortOptionsService), new ShowRecentUsageReaction(NormalizedUsageOrderServiceMock.Object) }; UpdateReactionMapping = new UpdateReactionMapping(updateReactions); } if (UpdateReactionManager == null) { UpdateReactionManager = new UpdateReactionManager( UpdateReactionMapping, UserPreferences); } var manager = new DocumentMetadataManager( CollectionViewGenerator ?? new CollectionViewGenerator(), CountdownTimer ?? new TestingCountdownTimer(), DocumentMetadataEqualityService ?? new DocumentMetadataEqualityService(), DocumentMetadataFactory, NormalizedUsageOrderServiceMock.Object, ProjectItemServiceMock.Object, TimeProviderMock.Object, UpdateReactionManager, UserPreferences); // Initialization logic in the constructor of // DocumentMetadataManager will make calls on the mock // NormalizedUsageOrderService. Reset calls so that these are not // counted in the tests that the created DocumentMetadataManager // will be used in. NormalizedUsageOrderServiceMock.Invocations.Clear(); return(manager); }
private IUpdateReaction[] CreateUpdateReactions() { var updateReactions = new IUpdateReaction[] { new AssignProjectColoursReaction(Mock.Of <IProjectBrushService>()), new GroupByProjectReaction(), new PathSegmentCountReaction(Mock.Of <IFilePathService>()), new SelectedSortOptionReaction(Mock.Of <ISortOptionsService>()), new ShowRecentUsageReaction(Mock.Of <INormalizedUsageOrderService>()) }; return(updateReactions); }