예제 #1
0
        public ProjectNotifier(ISolutionNotifier solutionNotifier, IProjectEnumerator projectEnumerator)
        {
            var hotProjectStream = solutionNotifier.SolutionOpenedStream.Select(solutionInfo =>
            {
                var projectInfos = projectEnumerator.GetLoadedProjects(solutionInfo);

                var solutionChangeStream = solutionNotifier.ProjectAddedStream
                                           .Merge(solutionNotifier.ProjectRemovingtream)
                                           .TakeUntil(solutionNotifier.SolutionClosingStream);

                var emptyProjectInfos = new ProjectInfo[0];

                var solutionClosedStream = solutionNotifier.SolutionClosingStream
                                           .Select(_ => emptyProjectInfos);

                var projectChangeStream = solutionChangeStream
                                          .Select(_ => projectEnumerator.GetLoadedProjects(solutionInfo))
                                          .Merge(solutionClosedStream)
                                          .StartWith(projectInfos);

                return(projectChangeStream);
            })
                                   .Switch()
                                   .Replay(1);

            hotProjectStream.Connect().DisposeWith(disposables);

            ProjectStream = hotProjectStream;
        }
예제 #2
0
        public virtual void before_each()
        {
            autoSubstitute = new AutoSubstitute();

            solutionOpenedStream  = new Subject <SolutionInfo>();
            solutionClosingStream = new Subject <Unit>();
            projectAddedStream    = new Subject <ProjectInfo>();
            projectRemovingtream  = new Subject <ProjectInfo>();

            var solutionNotifier = autoSubstitute.Resolve <ISolutionNotifier>();

            solutionNotifier.SolutionOpenedStream.Returns(solutionOpenedStream);
            solutionNotifier.SolutionClosingStream.Returns(solutionClosingStream);
            solutionNotifier.ProjectAddedStream.Returns(projectAddedStream);
            solutionNotifier.ProjectRemovingtream.Returns(projectRemovingtream);

            projectEnumerator = autoSubstitute.Resolve <IProjectEnumerator>();

            notifier = autoSubstitute.Resolve <ProjectNotifier>();

            testProjectObserver = new TestScheduler().CreateObserver <IEnumerable <ProjectInfo> >();

            subscription = notifier.ProjectStream.Subscribe(testProjectObserver);

            someSolution = new SolutionInfo();

            someProjectInfos = new []
            {
                new ProjectInfo(),
                new ProjectInfo(),
                new ProjectInfo(),
            };
        }
 public UpdateProjectFramework(IProjectEnumerator enumerator,IProjectUpdater updater)
 {
     this.enumerator = enumerator;
     this.updater = updater;
 }