public List <Project> GetAllProjects(string siteName = null) { var result = new List <Project>(); if (siteName == null) { siteName = SiteContext.CurrentSiteName; } using (var cs = new CachedSection <List <Project> >(ref result, CacheHelper.CacheMinutes(siteName), true, _projectCacheKey)) { if (cs.LoadData) { result = ProjectProvider.GetProjects().OnSite(siteName).ToList(); var cacheDependencies = new List <string> { $"nodes|{siteName}|{Project.CLASS_NAME}|all" }; cs.Data = result; cs.CacheDependency = CacheHelper.GetCacheDependency(cacheDependencies); } } return(result); }
public SelfConfigController() { _userProvider = new UserProvider(_httpClient); _projectProvider = new ProjectProvider(_httpClient); _subscriptionProvider = new SubscriptionProvider(_httpClient, _projectProvider); _selfConfigManager = new SelfConfigManager(_subscriptionProvider, _projectProvider); }
/// <summary> /// Initializes a new instance of the <see cref="T:ProjectItemIsUniqueValidator"/> class. /// </summary> /// <param name="projectProvider">The current project provider.</param> /// <param name="languageExtension">The language extension.</param> /// <param name="errorMessage">The error message.</param> public ProjectItemIsUniqueValidator( ProjectProvider projectProvider, string languageExtension, string errorMessage) : base(errorMessage, null) { this.projectProvider = projectProvider; this.languageExtension = languageExtension; }
public void ConvertToModelTest() { ProjectProvider target = new ProjectProvider(); baseProjectView item = _baseProjectView; Project expected = _Project; Project actual; actual = target.ConvertToModel(item); CompareModelObject(expected, actual); }
public void ConvertToViewTest() { ProjectProvider target = new ProjectProvider(); Project item = _Project; baseProjectView expected = _baseProjectView; baseProjectView actual; actual = target.ConvertToView(item); CompareViewObject(expected, actual); }
/// <summary> /// Replaces PackageReference references marked with the /// Temp attribute to Reference. Transitive dependencies /// will be included. /// </summary> /// /// <exception cref="SwitcherFileNotFoundException"/> /// /// <exception cref="FileNotFoundException"/> /// /// <exception cref="ArgumentException"> public override IEnumerable <string> Switch() { void Executor(IProjectReference reference, LockFileTargetLibrary library, string absolutePath) { SwitchSysDependency(reference, library); SwitchPkgDependency(reference, library, absolutePath); } IterateAndExecute(ProjectProvider.GetLoadedProject(), Executor); return(default);
public MainWindowModelView() : base(typeof(MainWindowModelView).Name) { NewProjectCommand = new RelayCommand(OnNewProjectCommand, x => !ProjectProvider.GetInstance().IsProjectActive()); OpenProjectCommand = new RelayCommand(OnOpenProjectCommand, x => !ProjectProvider.GetInstance().IsProjectActive()); CloseProjectCommand = new RelayCommand(OnCloseProjectCommand, x => ProjectProvider.GetInstance().IsProjectActive()); ExitCommand = new RelayCommand(OnExitCommand); GenerateCSVCommand = new RelayCommand(OnGenerateCSVCommand, x => ProjectProvider.GetInstance().IsProjectActive() && ModelViewsUtil.IsType(x, NavigationType.PROJECT)); GenerateLiquibaseCommand = new RelayCommand(OnGenerateLiquibaseCommand, x => ProjectProvider.GetInstance().IsProjectActive() && ModelViewsUtil.IsType(x, NavigationType.PROJECT)); GenerateGuidCommand = new RelayCommand(OnGenerateGuidCommand); SettingsCommand = new RelayCommand(OnSettingsCommand, x => ProjectProvider.GetInstance().IsProjectActive()); AboutCommand = new RelayCommand(OnAboutCommand); }
public void AllProjectsShouldBeEmptyWhenNoProjectIsConfigured() { // Arrange var pluginRepository = Substitute.For <IPluginRepository>(); var configuration = new Configuration(); var sut = new ProjectProvider(configuration, pluginRepository); // Act var actual = sut.AllProjects().ToList(); // Assert Assert.Empty(actual); }
private void fillProjects() { if (UserOptions != null && ProjectProvider != null) { var user = UserOptions.getOptions().Username; IList <Project> projects; new Action(() => { //May Take a while projects = ProjectProvider.getProjectsForUser(user); DispatcherHelper.CheckBeginInvokeOnUI(() => { Projects = projects; }); }).BeginInvoke(null, null); } }
public void Setup() { _fixture = new Fixture(); _projectRepository = new Mock <IProjectRepository>(); _eventSinkMock = new Mock <IEventSink>(); _eventBus = new Mock <IEventBus>(); var paginationSettings = new ProjectManagement.Domain.PaginationSettings(10); _projectRepository .Setup(repo => repo.SaveProject(It.IsAny <Project>())) .Returns(1); _projectProvider = new ProjectProvider( _projectRepository.Object, _eventSinkMock.Object, paginationSettings, new IssuePaginationSettings(25), _eventBus.Object); }
public void ConvertToViewListTest() { ProjectProvider target = new ProjectProvider(); List <Project> itemlist = new List <Project>(); itemlist.Add(_Project); itemlist.Add(_Project); List <baseProjectView> expected = new List <baseProjectView>(); expected.Add(_baseProjectView); expected.Add(_baseProjectView); List <baseProjectView> actual; actual = target.ConvertToViewList(itemlist); Assert.AreEqual(expected.Count, actual.Count); CompareViewObject(expected[0], actual[0]); CompareViewObject(expected[1], actual[1]); }
/// <summary> /// Replaces ProjectReference references marked /// with the Temp attribute to PackageReference. /// </summary> /// /// <exception cref="SwitcherException"/> public override IEnumerable <string> Switch() { HashSet <string> output = new HashSet <string> (); MessageProvider.Clear(); foreach (IProjectReference reference in ProjectProvider.GetLoadedProject()) { output.UnionWith(SwitchDependency(reference, ReferenceType.Reference)); output.UnionWith(SwitchDependency(reference, ReferenceType.ProjectReference)); reference.Save(); } RemoveFromSolution(ProjectProvider.Solution, output); return(output); }
public void EnabledProjectsShouldNotContainDisabledProjectsDefinedInConfiguration() { // Arrange var pluginRepository = Substitute.For <IPluginRepository>(); var configuration = CreateConfiguration(); configuration.Projects.Add(CreateProjectConfiguration("p1", false)); configuration.Projects.Add(CreateProjectConfiguration("p2")); configuration.Projects.Add(CreateProjectConfiguration("p3")); var sut = new ProjectProvider(configuration, pluginRepository); // Act var actual = sut.EnabledProjects().ToList(); // Assert Assert.Collection(actual.Select(p => p.Name), x => Assert.Equal("p2", x), x => Assert.Equal("p3", x) ); }
/// <summary> /// Replaces PackageReference references marked /// with the Temp attribute to ProjectReference. /// Transitive dependencies will be included. /// </summary> /// /// <exception cref="SwitcherFileNotFoundException"/> /// /// <exception cref="FileNotFoundException"/> /// /// <exception cref="ArgumentException"> /// /// <remarks> /// All projects detected during /// the work will be included in /// the solution. /// </remarks> public override IEnumerable <string> Switch() { HashSet <string> output = new HashSet <string> (); IEnumerable <IProjectReference> references = ProjectProvider.GetLoadedProject(); void Executor(IProjectReference reference, LockFileTargetLibrary library, string absolutePath) { SwitchSysDependency(reference, library); SwitchPkgDependency(reference, library, absolutePath); output.Add(absolutePath); } IterateAndExecute(references, Executor); AddToSolution(ProjectProvider.Solution, output); return(output); }
/// <summary> /// Initializes a new instance of the <see cref="T:ProjectItemIsUniqueValidator"/> class. /// </summary> /// <param name="projectProvider">The current project provider.</param> /// <param name="languageExtension">The language extension.</param> public ProjectItemIsUniqueValidator( ProjectProvider projectProvider, string languageExtension) : this(projectProvider, languageExtension, Resources.ProjectItemIsUniqueValidatorMessage) { }
protected override void OnSuccessful(ExecutionEvent executionEvent, Guid affectedObjectId) { Publisher.GetInstance().ServerChanged(null); ProjectProvider.GetInstance().SetProjectActive(false); }
public void ProjectProviderConstructorTest() { ProjectProvider target = new ProjectProvider(); }
protected XDocument GetProject() { return(ProjectProvider.LoadProjectDocument()); }
public SelfConfigManager(SubscriptionProvider subscriptionProvider, ProjectProvider projectProvider) { _subscriptionProvider = subscriptionProvider ?? throw new ArgumentNullException(nameof(subscriptionProvider)); _projectProvider = projectProvider ?? throw new ArgumentNullException(nameof(projectProvider)); }