using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RainmeterStudio.Business;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.Tests.Business
{
///
/// Common stuff for project manager tests
///
public class ProjectManagerTestBase
{
#region Project template
///
/// A sample project template
///
protected class TestTemplate : IProjectTemplate
{
public string Name
{
get { return "TestTemplate"; }
}
public IEnumerable Properties
{
get { return Enumerable.Empty(); }
}
public Project CreateProject()
{
return new Project();
}
}
#endregion
///
/// Gets or sets the text context
///
public TestContext TestContext { get; set; }
///
/// Gets or sets the project manager
///
protected virtual ProjectManager ProjectManager { get; set; }
///
/// Gets or sets the sample project template
///
protected virtual IProjectTemplate ProjectTemplate { get; set; }
///
/// Sets up the test
///
[TestInitialize]
public void Initialize()
{
string testDirectory = Path.Combine(TestContext.DeploymentDirectory, TestContext.TestName);
Directory.CreateDirectory(testDirectory);
Directory.SetCurrentDirectory(testDirectory);
// Set up project manager
ProjectManager = new ProjectManager();
// Set up project template
ProjectTemplate = new TestTemplate();
ProjectManager.RegisterProjectTemplate(ProjectTemplate);
OnInitialize();
}
public virtual void OnInitialize()
{
}
}
}