public void PublishSettings_RoundTrip_Works() { var jsonPath = Path.Combine(_folder.Path, BookInfo.MetaDataFileName); File.WriteAllText(jsonPath, @"{""suitableForMakingShells"":""true""}"); var original = new BookInfo(_folder.Path, true); original.PublishSettings.AudioVideo.PlayerSettings = "{\"lang\":\"fr\",\"imageDescriptions\":true}"; original.Save(); var restored = new BookInfo(_folder.Path, true); Assert.That(restored.PublishSettings.AudioVideo.PlayerSettings, Is.EqualTo(original.PublishSettings.AudioVideo.PlayerSettings)); }
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)); }