/// <summary> /// Create a new instance of a controller. Made private as to only allow one instance /// to be created. External sources should get the controller from <c>Controller.Instance;</c> /// </summary> /// <param name="model">FileModel to use (local or web?)</param> private Controller(IFileModel model = null) { if (model == null) { model = new LocalFileModel(); } fileModel = model; userModel = new UserModel(); }
/// <summary> /// Create a new instance of a controller. Made private as to only allow one instance /// to be created. External sources should get the controller from <c>Controller.Instance;</c> /// </summary> /// <param name="model">FileModel to use (local or web?)</param> private Controller(IFileModel model = null) { if (model == null) model = new LocalFileModel(); fileModel = model; userModel = new UserModel(); }
public void TestSyncProjects() { LocalFileModel model = new LocalFileModel(); IAsyncResult ar = controller.BeginSyncProjects("*****@*****.**", "pw", null, null); IEnumerable<Project> projectsSynced = controller.EndSyncProjects(ar); Assert.IsTrue(projectsSynced.Count() > 0); }
public void TestProjectShare() { LocalFileModel model = new LocalFileModel(); IEnumerable<Project> projects = model.GetProjects("local"); Project project = projects.First(); model.UploadStructure("*****@*****.**"); model.FindProjects(); projects = model.GetProjects("local"); project = projects.First(); Assert.AreEqual(1, projects.Count()); string[] emails = {"*****@*****.**"}; IAsyncResult shareAr = controller.BeginShareProject(project, emails, null, null); controller.EndShareProject(shareAr); using (var dbContext = new sliceofpieEntities2()) { var projectUsers = from projectUser in dbContext.ProjectUsers where projectUser.ProjectId == project.Id && projectUser.UserEmail == "*****@*****.**" select projectUser; Assert.AreEqual(1, projectUsers.Count()); } }
public void TestDownloadRevisions() { LocalFileModel model = new LocalFileModel(); //To reinitialize the underlying filesystem Project p = controller.CreateProject("Thirteen-Thirtyseven", "*****@*****.**"); Document d = controller.CreateDocument("Fourty-Two", "*****@*****.**", p); d.CurrentRevision = "Noget ordentligt"; controller.SaveDocument(d); IEnumerable<Project> projects = controller.SyncProjects("*****@*****.**", "pw"); p = projects.First(project => project.Title.Equals(p.Title)); d = p.GetDocuments().First(); IAsyncResult ar = controller.BeginDownloadRevisions(d, null, null); IEnumerable<Revision> result = controller.EndDownloadRevisions(ar); Assert.IsTrue(result.Count() > 0); }
public void Initialize() { TestHelper.ClearDatabase("*****@*****.**"); TestHelper.ClearFolder(AppPath); Model = new LocalFileModel(); }