Save() public method

public Save ( ) : void
return void
Ejemplo n.º 1
0
        public void RoundTrips_AllowUploading()
        {
            var jsonPath = Path.Combine(_folder.Path, BookInfo.MetaDataFileName);
            File.WriteAllText(jsonPath, @"{'allowUploadingToBloomLibrary':'false'}");
            var bi = new BookInfo(_folder.Path, true);
            Assert.False(bi.AllowUploading, "CHECK YOUR FixBloomMetaInfo ENV variable! Initial Read Failed to get false. Contents: " + File.ReadAllText(jsonPath));
            bi.Save();
            var bi2 = new BookInfo(_folder.Path, true);
            Assert.False(bi2.AllowUploading, "Read after Save() Failed  to get false. Contents: " + File.ReadAllText(jsonPath));

            File.WriteAllText(jsonPath, @"{'allowUploadingToBloomLibrary':'true'}");
            var bi3 = new BookInfo(_folder.Path, true);
            Assert.That(bi3.AllowUploading,  "Initial Read Failed to get true. Contents: " + File.ReadAllText(jsonPath));
            bi3.Save();
            var bi4 = new BookInfo(_folder.Path, true);
            Assert.That(File.ReadAllText(jsonPath).Contains("allowUploadingToBloomLibrary"), "The file doesn't contain 'allowUploadingToBloomLibrary'");
            Assert.That(bi4.AllowUploading, "Read after Save() Failed  to get true. Contents: " + File.ReadAllText(jsonPath));
        }