Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Annotate tests
  • Loading branch information
maxkoshevoi committed Aug 14, 2021
commit 8c97f908f6569c3e8499bddb5e45ae134c4bfa76
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,32 @@ public static class TestStreamHelpers
{
public static readonly string ArbitraryFilePath = "Unit tests do not touch file system";

public static IFileProvider StringToFileProvider(string str)
public static IFileProvider StringToFileProvider(string? str)
{
return new TestFileProvider(str);

}

private class TestFile : IFileInfo
{
private readonly string _data;
private readonly string? _data;

public TestFile(string str)
public TestFile(string? str)
{
_data = str;
}

public bool Exists
{
get
{
return true;
}
}
public bool Exists => true;

public bool IsDirectory
{
get
{
return false;
}
}
public bool IsDirectory => false;

public DateTimeOffset LastModified
{
get
{
throw new NotImplementedException();
}
}
public DateTimeOffset LastModified => throw new NotImplementedException();

public long Length
{
get
{
return 0;
}
}
public long Length => 0;

public string Name
{
get
{
return null;
}
}
public string Name => string.Empty;

public string PhysicalPath
{
get
{
return null;
}
}
public string? PhysicalPath => null;

public Stream CreateReadStream()
{
Expand All @@ -83,13 +47,13 @@ public Stream CreateReadStream()

private class TestFileProvider : IFileProvider
{
private string _data;
public TestFileProvider(string str)
private string? _data;
public TestFileProvider(string? str)
{
_data = str;
}

public IDirectoryContents GetDirectoryContents(string subpath)
public IDirectoryContents GetDirectoryContents(string? subpath)
{
throw new NotImplementedException();
}
Expand All @@ -99,13 +63,13 @@ public IFileInfo GetFileInfo(string subpath)
return new TestFile(_data);
}

public IChangeToken Watch(string filter)
public IChangeToken Watch(string? filter)
{
throw new NotImplementedException();
}
}

public static Stream StringToStream(string str)
public static Stream StringToStream(string? str)
{
var memStream = new MemoryStream();
var textWriter = new StreamWriter(memStream);
Expand Down
Loading