public void JsonEntityFileStringFileSystem_WithValidArgs_IsNotNull() { // Act _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(_fakeFilePath, _mockFileSystem); // Assert Assert.IsNotNull(_entityFile); }
public void JsonEntityFileString_WithValidFilePath_IsNotNull() { // Act _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(_fakeFilePath); // Assert Assert.IsNotNull(_entityFile); }
/// <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); }
/// <summary> /// Returns the recording from the designated <paramref name="filePath"/>. /// </summary> /// <param name="filePath">The file path location of where the recording is stored.</param> /// <returns>Returns the recording from the designated <paramref name="filePath"/>.</returns> public IRecording GetRecording(string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); } if (!_fileSystem.File.Exists(filePath)) { throw new FileNotFoundException($"Invalid filePath. Could not find a recording at '{filePath}'."); } // Read the json from the file and convert it to the serialized version. var serializedRecording = new JsonEntityFile <SerializedRecording>(filePath, _fileSystem).GetEntity(); return(Deserialize(serializedRecording)); }
public void JsonEntityFileStringFileSystem_WithNullFileSystem_ThrowsException() { // Act _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(_fakeFilePath, null); }
public void JsonEntityFileStringFileSystem_WithEmptyFilePath_ThrowsException() { // Act _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(string.Empty, _mockFileSystem); }
public void JsonEntityFileString_WithNullFilePath_ThrowsException() { // Act _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(null); }
public void Initialize() { _mockFileSystem = new MockFileSystem().Object; _entityFile = new JsonEntityFile <TestSerializedJsonEntity>(_fakeFilePath, _mockFileSystem); }