/// <summary> /// Gets the info pertaining to the archive set (Name of the set, type of drive that the archive is on, and Volume Label of the drive). /// </summary> /// <param name="archiveName"></param> /// <param name="path"></param> /// <returns></returns> public static Archive GetArchiveInfo(string archiveName, string path) { try { var drive = new DriveInfo(@path); var archiveInfo = new Archive(archiveName, drive.DriveType, drive.VolumeLabel); return archiveInfo; } catch (Exception) { return null; throw; } }
public void ArchiveInfoTest() { //Arrange string expectedName = "test"; System.IO.DriveType expectedMediaType = System.IO.DriveType.Fixed; string expectedlabel = "nolabel"; //Act var archiveInfo = new Archive("test", System.IO.DriveType.Fixed, "nolabel"); //Assert Assert.AreEqual(expectedName, archiveInfo.Name); Assert.AreEqual(expectedMediaType, archiveInfo.DriveType); Assert.AreEqual(expectedlabel, archiveInfo.Label); }
public void SaveTest() { //Arrange DateTime DTTester = DateTime.Now; var file = new File("test.txt", DTTester, "c:", (long)1000, "txt"); var archiveInfo = new Archive("test", System.IO.DriveType.Fixed, "nolabel"); //var listOfFiles = new List<IFile>(); //listOfFiles.Add(file); //var catalog = new Catalog(archiveInfo, listOfFiles); //Act using (var ctx = new EFRepositoryContext()) { ctx.Files.Add(file); ctx.Archives.Add(archiveInfo); ctx.SaveChanges(); } //Assert Assert.Fail(); }
public Catalog(Archive archive, ICollection<IFile> files) { FileSet.Add(archive, files); }