Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit edb0636

Browse files
committed
added LineReplacerTests
1 parent 8256055 commit edb0636

3 files changed

Lines changed: 67 additions & 0 deletions

File tree

‎CassetteHelperTests/CassetteHelperTests.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
</Reference>
7575
</ItemGroup>
7676
<ItemGroup>
77+
<Compile Include="LineReplacer.cs" />
7778
<Compile Include="Properties\AssemblyInfo.cs" />
7879
<Compile Include="ReferenceVisitorTests.cs" />
7980
</ItemGroup>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.IO;
3+
using MbUnit.Framework;
4+
5+
namespace CassetteHelperTests
6+
{
7+
[TestFixture]
8+
public class LineReplacerTests
9+
{
10+
[Test, ExpectedException(typeof(FileNotFoundException))]
11+
public void IfFileDoesNotExistThrowsFileNotFoundException()
12+
{
13+
new LineReplacer("test.js");
14+
}
15+
16+
[Test, ExpectedArgumentNullException("filePath")]
17+
[Row("")]
18+
[Row(null)]
19+
public void NullOrEmptyFilePathThrowsArgumentNullException(string filePath)
20+
{
21+
new LineReplacer(filePath);
22+
}
23+
}
24+
25+
public class LineReplacer
26+
{
27+
public LineReplacer(string filePath)
28+
{
29+
if (string.IsNullOrEmpty(filePath)) throw new ArgumentNullException("filePath");
30+
if(!File.Exists(filePath)) throw new FileNotFoundException("Could not find file to replace lines in", filePath);
31+
}
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.IO;
3+
using MbUnit.Framework;
4+
5+
namespace CassetteHelperTests
6+
{
7+
[TestFixture]
8+
public class LineReplacerTests
9+
{
10+
[Test, ExpectedException(typeof(FileNotFoundException))]
11+
public void IfFileDoesNotExistThrowsFileNotFoundException()
12+
{
13+
new LineReplacer("test.js");
14+
}
15+
16+
[Test, ExpectedArgumentNullException("filePath")]
17+
[Row("")]
18+
[Row(null)]
19+
public void NullOrEmptyFilePathThrowsArgumentNullException(string filePath)
20+
{
21+
new LineReplacer(filePath);
22+
}
23+
}
24+
25+
public class LineReplacer
26+
{
27+
public LineReplacer(string filePath)
28+
{
29+
if (string.IsNullOrEmpty(filePath)) throw new ArgumentNullException("filePath");
30+
if(!File.Exists(filePath)) throw new FileNotFoundException("Could not find file to replace lines in", filePath);
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)