public void Ctor_FileInfo_SourceFile() { // Arrange var fakeFile = new FakeFileInfo(); // Act using var stream = new InputStream(fakeFile); // Assert Equal($"file('{FakeFileInfo.DefaultPhysicalPath}')", stream.Source); }
public void Create_ValidJsonFile_CreateConfigurationTracker() { // Arrange var fakeFile = new FakeFileInfo(); // Act var tracker = ConfigurationTrackerFactory.CreateFromJson( fakeFile.CreateByteArray(), Shared.DefaultPattern); // Assert Equal(2, tracker.CapturedCount); }
public void Ctor_FileIsDirectory_Throw() { // Arrange var fakeFile = new FakeFileInfo { IsDirectory = true }; // Act Stream Sut() => new InputStream(fakeFile); // Assert Throws <ArgumentException>(Sut); }
public void Ctor_FileDoesNotExists_Throw() { // Arrange var fakeFile = new FakeFileInfo { Exists = false }; // Act Stream Sut() => new InputStream(fakeFile); // Assert Throws <ArgumentException>(Sut); }
public async Task Create_ValidJsonFile_CreateConfigurationTrackerPrefix() { // Arrange const string prefix = "PREFIX_"; var fakeFile = new FakeFileInfo(); var writer = new StringWriter(); // Act var tracker = ConfigurationTrackerFactory.CreateFromJson( fakeFile.CreateByteArray(), Shared.DefaultPattern, prefix); await tracker.WriteTo(writer).ConfigureAwait(false); // Assert Equal(2, tracker.CapturedCount); var values = writer.ToString().Split(Environment.NewLine); foreach (var value in values) { StartsWith(prefix, value, StringComparison.InvariantCulture); } }