public AddAssigmentServiceTests() { // _assigmentFactory(Arg.Any<string>(), Arg.Any<ITag[]>()).Returns(info => // { // throw new Exception("Call not setuped factory"); // }); // _tagFactory(Arg.Any<string>()).Returns(info => // { // throw new Exception("Call not setuped factory"); // }); _addAssigmentService = new AddAssigmentService(_assigmentsCache, _tagsCache, _assigmentFactory, _tagFactory); }
public static MainWindowViewModel CreateWindowViewModel() { Func<string, ITag[], IAssigment> assigmentFactory = (s, tags) => new Assigment(s, tags); Func<ITag, ITagViewModel> tagViewModelFactory = (m) => new TagViewModel(m); var assigmentsCache = new AssigmentCache(); var tagsCache = new TagsCache(); var addAssigmentService = new AddAssigmentService(assigmentsCache, tagsCache, assigmentFactory, CreateTagFactory(tagsCache)); var tagVisibilityService = new TagVisibilityService(); Func<IAssigment, IAssigmentViewModel> assigmentViewModelFactory = (m) => new AssigmentViewModel(m, tagViewModelFactory, tagVisibilityService); Func<ITag, ISelectableTagViewModel> selectableTagViewModelFactory = (m) => new SelectableTagViewModel(m, tagVisibilityService); return new MainWindowViewModel(assigmentsCache, tagsCache, addAssigmentService, assigmentViewModelFactory, selectableTagViewModelFactory); }