public void TestCreateAnalysis3() { var storage = new AnalysisStorage(_taskScheduler, _filesystem, _dataSourceAnalyserEngine.Object, _typeFactory); var analysisTemplate = new AnalysisTemplate(); var analysisViewTemplate = new AnalysisViewTemplate(); var analysis = storage.CreateAnalysis(analysisTemplate, analysisViewTemplate); analysisViewTemplate.Add(new PageTemplate { Title = "A great page" }); var task = storage.SaveAsync(analysis.Id); task.Should().NotBeNull(); task.Wait(TimeSpan.FromSeconds(5)).Should().BeTrue("because the modified template should've been saved"); var anotherStorage = new AnalysisStorage(_taskScheduler, _filesystem, _dataSourceAnalyserEngine.Object, _typeFactory); anotherStorage.AnalysisTemplates.Should().HaveCount(1, "because we've created and saved one template"); var template = anotherStorage.AnalysisTemplates.First(); template.Should().NotBeNull(); template.ViewTemplate.Pages.Should().HaveCount(1, "because we've added one page to that template"); var pageTemplate = template.ViewTemplate.Pages.First(); pageTemplate.Should().NotBeNull(); pageTemplate.Title.Should().Be("A great page"); }
public void TestCtorTemplateTwoPages() { _viewTemplate.Add(new PageTemplate { Title = "Page A" }); _viewTemplate.Add(new PageTemplate { Title = "Page B" }); var model = new AnalysisViewModel(_dispatcher, _viewTemplate, _analyser.Object, _analysisStorage.Object, _pluginRegistry); model.Pages.Should().NotBeNull(); model.Pages.Should().HaveCount(2); model.Pages.First().Should().NotBeNull(); model.Pages.First().Name.Should().Be("Page A"); model.Pages.Last().Should().NotBeNull(); model.Pages.Last().Name.Should().Be("Page B"); }
private void AddPage() { var template = new PageTemplate(); var page = new AnalysisPageViewModel(template, _analyser); page.OnDelete += PageOnOnDelete; _pages.Add(page); _viewTemplate.Add(template); UpdateCanBeDeleted(); }