public void SaveToFileNullPathShouldFail() { JsonPublicKeySource obj = new JsonPublicKeySource(); var exceptionStf = Assert.Throws <Exception>(() => obj.SaveToFile()); Assert.NotNull(exceptionStf); Assert.Contains("Not loaded from file.", exceptionStf.Message); }
public void SaveToFileNoFileExistFail() { JsonPublicKeySource obj = new JsonPublicKeySource(); string randFileName = RandomString(6) + ".json"; obj.LoadFromFile(randFileName, true); File.Delete(randFileName); var exceptionStf = Assert.Throws <FileNotFoundException>(() => obj.SaveToFile()); Assert.NotNull(exceptionStf); Assert.Contains("Source file no longer exists.", exceptionStf.Message); }