public void CheckoutFileTest() { string projectFile = Path.GetTempFileName(); SccProviderStorage target = new SccProviderStorage(projectFile); target.CheckinFile(projectFile); // Test the file is readonly Assert.AreEqual(File.GetAttributes(projectFile) & FileAttributes.ReadOnly, FileAttributes.ReadOnly, "Checkin failed"); target.CheckoutFile(projectFile); // Test the file is readwrite Assert.AreEqual(File.GetAttributes(projectFile) & FileAttributes.ReadOnly, (FileAttributes)0, "Checkout failed"); // Cleanup the files written by the test File.Delete(projectFile); }
public void GetFileStatusTest() { string projectFile = Path.GetTempFileName(); string storageFile = projectFile + ".storage"; if (File.Exists(storageFile)) { File.Delete(storageFile); } SccProviderStorage target = new SccProviderStorage(projectFile); IList<string> files = new List<string>(); files.Add(projectFile); target.AddFilesToStorage(files); // Test that project file is now controlled Assert.AreEqual(SourceControlStatus.scsCheckedIn, target.GetFileStatus(projectFile), "GetFileStatus failed for project file"); // Checkout the file and test status again target.CheckoutFile(projectFile); Assert.AreEqual(SourceControlStatus.scsCheckedOut, target.GetFileStatus(projectFile), "GetFileStatus failed for project file"); // Test that a dummy file is uncontrolled Assert.AreEqual(SourceControlStatus.scsUncontrolled, target.GetFileStatus("Dummy.txt"), "GetFileStatus failed for uncontrolled file"); // Cleanup the files written by the test File.Delete(projectFile); File.Delete(storageFile); }