You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
957 B
35 lines
957 B
1 year ago
|
using Recyclarr.Common;
|
||
|
|
||
|
namespace Recyclarr.Tests.Common;
|
||
3 years ago
|
|
||
|
[TestFixture]
|
||
|
public class ResourceDataReaderTest
|
||
4 years ago
|
{
|
||
3 years ago
|
[Test]
|
||
|
public void GetResourceData_DefaultDir_ReturnResourceData()
|
||
4 years ago
|
{
|
||
1 year ago
|
var testData = new ResourceDataReader(GetType());
|
||
3 years ago
|
var data = testData.ReadData("DefaultDataFile.txt");
|
||
|
data.Trim().Should().Be("DefaultDataFile");
|
||
|
}
|
||
4 years ago
|
|
||
3 years ago
|
[Test]
|
||
|
public void GetResourceData_NonexistentFile_Throw()
|
||
|
{
|
||
1 year ago
|
var testData = new ResourceDataReader(GetType());
|
||
3 years ago
|
Action act = () => testData.ReadData("DataFileWontBeFound.txt");
|
||
4 years ago
|
|
||
3 years ago
|
act.Should()
|
||
|
.Throw<ArgumentException>()
|
||
|
.WithMessage("Embedded resource not found*");
|
||
|
}
|
||
4 years ago
|
|
||
3 years ago
|
[Test]
|
||
|
public void ReadData_ExplicitSubDir_ReturnResourceData()
|
||
|
{
|
||
1 year ago
|
var testData = new ResourceDataReader(GetType(), "TestData");
|
||
3 years ago
|
var data = testData.ReadData("DataFile.txt");
|
||
|
data.Trim().Should().Be("DataFile");
|
||
4 years ago
|
}
|
||
|
}
|