Skip to content

Commit

Permalink
covering SharedParameterFile.Save with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salaros committed Jun 12, 2018
1 parent 2d284a1 commit 86ecce7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public class ParameterCollection : List<ParameterDefinition>
/// <exception cref="T:System.ArgumentNullException">parameterFile</exception>
/// <inheritdoc />
public ParameterCollection(SharedParameterFile parameterFile, IEnumerable<ParameterDefinition> parameters)
:base(parameters)
:base(parameters ?? new List<ParameterDefinition>())
{
this.parameterFile = parameterFile ?? throw new ArgumentNullException(nameof(parameterFile));
}
Expand Down
14 changes: 14 additions & 0 deletions tests/SharedParameterFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,19 @@ public void FileIsSerializedProperly()

Assert.Equal(simpleSharedFromBuiltText, simpleSharedFromDisk);
}
/// <summary>
/// Saves the a catalog to a file.
/// </summary>
[Fact]
public void SavingSharedParametersToFile()
{
var sharedParamFile = new SharedParameterFile();
sharedParamFile.Parameters.Add(
new Guid("61ff3d56-09d7-4049-8c78-4abe745e4e5a"), "EquipmentName",
"Identity Data", ParameterType.Text
);
var sharedParamFileTmp = $"{Path.GetTempFileName()}.txt";
Assert.True(sharedParamFile.Save(sharedParamFileTmp) && File.Exists(sharedParamFileTmp));
}
}
}

0 comments on commit 86ecce7

Please sign in to comment.