public void AlreadyExists_DoesNotExist() { using (var tempDirPath = new TemporaryFolder(Path.GetRandomFileName())) { string file = Path.ChangeExtension(Path.GetRandomFileName(), ".mp3"); string destination = tempDirPath.Combine(tempDirPath.Path, file); Assert.IsTrue(WavConverter.AlreadyExists(_goodWavFile, destination) == SaveFile.DoesNotExist, "AlreadyExists did not recognize that the destination does not already exist."); } }
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."); } }
public void AlreadyExists_IdenticalExists() { using (var tempDirPath = new TemporaryFolder(Path.GetRandomFileName())) { string file = Path.ChangeExtension(Path.GetRandomFileName(), ".mp3"); string destination = tempDirPath.Combine(tempDirPath.Path, file); WavConverter.WavToMp3(_goodWavFile, destination); Assert.IsTrue(WavConverter.AlreadyExists(_goodWavFile, destination) == SaveFile.IdenticalExists, "AlreadyExists did not recognize that the converted file already exists."); } }