public static UnconfiguredProjectServices Create(IProjectThreadingService?threadingService = null, IProjectFaultHandlerService?projectFaultHandlerService = null,
                                                         IProjectService?projectService            = null)
        {
            projectFaultHandlerService ??= IProjectFaultHandlerServiceFactory.Create();
            threadingService ??= IProjectThreadingServiceFactory.Create();

            var projectLockService = IProjectLockServiceFactory.Create();

            var mock = new Mock <UnconfiguredProjectServices>();

            if (projectService == null)
            {
                projectService = IProjectServiceFactory.Create(ProjectServicesFactory.Create(threadingService, projectLockService: projectLockService));
            }
            mock.SetupGet(p => p.ProjectService)
            .Returns(projectService);

            mock.Setup(p => p.ProjectLockService)
            .Returns(projectLockService);

            mock.Setup(p => p.FaultHandler)
            .Returns(projectFaultHandlerService);

            return(mock.Object);
        }
        public void Constructor_NullAsActiveConfguredProjectProperties_ThrowsArgumentNull()
        {
            var project                 = UnconfiguredProjectFactory.Create();
            var projectTree             = new Lazy <IPhysicalProjectTree>(() => IPhysicalProjectTreeFactory.Create());
            var threadingService        = new Lazy <IProjectThreadingService>(() => IProjectThreadingServiceFactory.Create());
            var projectProperties       = ProjectPropertiesFactory.Create(project);
            var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties.ConfiguredProject);
            var projectLockService      = new Lazy <IProjectLockService>(() => IProjectLockServiceFactory.Create());

            Assert.Throws <ArgumentNullException>("activeConfiguredProjectProperties", () => {
                new UnconfiguredProjectCommonServices(project, projectTree, threadingService, activeConfiguredProject, (ActiveConfiguredProject <ProjectProperties>)null, projectLockService);
            });
        }
Example #3
0
        public static UnconfiguredProjectServices Create(IProjectThreadingService threadingService)
        {
            var projectLockService = IProjectLockServiceFactory.Create();

            var mock = new Mock <UnconfiguredProjectServices>();

            mock.SetupGet(p => p.ProjectService)
            .Returns(IProjectServiceFactory.Create(ProjectServicesFactory.Create(threadingService, projectLockService: projectLockService)));

            mock.Setup(p => p.ProjectLockService)
            .Returns(projectLockService);

            return(mock.Object);
        }
        public void Constructor_ValueAsActiveConfiguredProjectProperties_SetsActiveConfiguredProjectPropertiesProperty()
        {
            var project                           = UnconfiguredProjectFactory.Create();
            var projectTree                       = new Lazy <IPhysicalProjectTree>(() => IPhysicalProjectTreeFactory.Create());
            var threadingService                  = new Lazy <IProjectThreadingService>(() => IProjectThreadingServiceFactory.Create());
            var projectProperties                 = ProjectPropertiesFactory.Create(project);
            var activeConfiguredProject           = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties.ConfiguredProject);
            var activeConfiguredProjectProperties = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties);
            var projectLockService                = new Lazy <IProjectLockService>(() => IProjectLockServiceFactory.Create());

            var services = new UnconfiguredProjectCommonServices(project, projectTree, threadingService, activeConfiguredProject, activeConfiguredProjectProperties, projectLockService);

            Assert.Same(projectProperties, services.ActiveConfiguredProjectProperties);
        }