Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }