public void GetEntity_WithExistingFile_ReturnsEntity() { // Arrange var testObj = new TestSerializedJsonEntity(111, "fakeName"); _entityFile.WriteEntity(testObj); // Act var returnedEntity = _entityFile.GetEntity(); // Assert Assert.IsNotNull(returnedEntity); Assert.IsTrue(testObj.Id == returnedEntity.Id); }
/// <summary> /// Saves the <paramref name="recording"/> to the file. /// </summary> /// <param name="recording">The recording that should be saved.</param> public void SaveRecording(IRecording recording) { if (recording == null) { throw new ArgumentNullException(nameof(recording)); } var serializedRecording = Serialize(recording); // Write the serialized recording to the specified file. var file = new JsonEntityFile <SerializedRecording>(recording.FilePath, _fileSystem); file.WriteEntity(serializedRecording); }
/// <summary> /// Saves the <paramref name="playbackConfig"/> to the file. /// </summary> /// <param name="playbackConfig">The playback configuration that should be saved.</param> public void SavePlaybackConfiguration(IPlaybackConfiguration playbackConfig) { if (playbackConfig == null) { throw new ArgumentNullException(nameof(playbackConfig)); } var serializedPlaybackConfig = Serialize(playbackConfig); // Write the serialized playback config to the specified file. var file = new JsonEntityFile <SerializedPlaybackConfig>(playbackConfig.FilePath, _fileSystem); file.WriteEntity(serializedPlaybackConfig); }