public void ReadExisting() { var expectedJson = JObject.Parse(SampleJsonString1); _storageWorker.ReadModifyWrite(_mockPath, content => expectedJson); var actualJson = _storageWorker.Read(_mockPath); JObjectAssert.AreEqual(expectedJson, actualJson); }
public void ReadModifyWriteNonExisting() { var expectedJson = JObject.Parse(SampleJsonString1); _storageWorker.ReadModifyWrite( _mockPath, content => { Assert.IsTrue(content.IsEmpty()); return(expectedJson); }); var actualJson = _storageWorker.Read(_mockPath); JObjectAssert.AreEqual(expectedJson, actualJson); }
public void ReadModifyWriteExisting() { var expectedJson = JObject.Parse(SampleJsonString1); _storageWorker.ReadModifyWrite(_mockPath, content => expectedJson); _storageWorker.ReadModifyWrite( _mockPath, content => { content["dog"] = "(^ .(I). ^)"; return(content); }); expectedJson["dog"] = "(^ .(I). ^)"; var actualJson = _storageWorker.Read(_mockPath); JObjectAssert.AreEqual(expectedJson, actualJson); }