Ejemplo n.º 1
0
 public void SaveBytes_SaveSingleFile()
 {
     using (var tempDirPath = new TemporaryFolder(Path.GetRandomFileName()))
     {
         byte[] bytes    = { 177, 209, 137, 61, 204, 127, 103, 88 };
         string fakeFile = tempDirPath.Combine(tempDirPath.Path, "abu3.mp3");
         WavConverter.SaveBytes(fakeFile, bytes);
         Assert.IsTrue(File.Exists(fakeFile), "SaveFile did not successfully save the bytes into a file.");
     }
 }
Ejemplo n.º 2
0
 public void SaveBytes_WrongExtension()
 {
     using (var tempDirPath = new TemporaryFolder(Path.GetRandomFileName()))
     {
         byte[] bytes    = { 177, 209, 137, 61, 204, 127, 103, 88 };
         string fakeFile = tempDirPath.Combine(tempDirPath.Path, "abu2.abc");
         WavConverter.SaveBytes(fakeFile, bytes);
         Assert.IsTrue(File.Exists(Path.ChangeExtension(fakeFile, ".mp3")), "SaveBytes did not change the extension of the SaveFile to .mp3.");
     }
 }
Ejemplo n.º 3
0
 public void AlreadyExists_NonIdenticalExists()
 {
     using (var tempDirPath = new TemporaryFolder(Path.GetRandomFileName()))
     {
         byte[] bytes    = { 177, 209, 137, 61, 204, 127, 103, 88 };
         string fakeFile = tempDirPath.Combine(tempDirPath.Path, "abu2.mp3");
         WavConverter.SaveBytes(fakeFile, bytes);
         Assert.IsTrue(WavConverter.AlreadyExists(_goodWavFile, fakeFile) == SaveFile.NotIdenticalExists, "AlreadyExists did not recognize that the destination exists but is not the converted version of the source.");
     }
 }