Skip to content

Commit 1be9c34

Browse files
committed
Unit test
1 parent 99abf27 commit 1be9c34

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

FakeApiTest/FakeHttpRequesterTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,5 +327,22 @@ public void ShouldThrowExceptionWhenFileNotExists()
327327
//Assert
328328
Assert.AreEqual("File FakePath not exists", exception.Message);
329329
}
330+
331+
[TestMethod]
332+
public void CreateResponseStream_ShouldThrowExceptionWhenFileNotExists()
333+
{
334+
//Arrange
335+
var responseMock = new HttpResponseMock();
336+
responseMock.File = "FakeFile";
337+
338+
//Act
339+
var ex = Assert.ThrowsException<FileLoadException>(() =>
340+
{
341+
FakeHttpRequester.CreateResponseStream(null, responseMock);
342+
});
343+
344+
//Assert
345+
Assert.AreEqual("File FakeFile not exists", ex.Message);
346+
}
330347
}
331348
}

Src/FakeApi/FakeHttpRequester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private static Mock<HttpWebResponse> CreateResponseMock(Config config, HttpRespo
9999
return response;
100100
}
101101

102-
private static MemoryStream CreateResponseStream(Config config, HttpResponseMock apiResponse)
102+
internal static MemoryStream CreateResponseStream(Config config, HttpResponseMock apiResponse)
103103
{
104104
var responseStream = new MemoryStream();
105105

0 commit comments

Comments
 (0)