public void Read_ShouldReturnAllLinesInStream() { _stream = new MemoryStream(Encoding.UTF8.GetBytes(Resources.SampleFileData)); _mockFactory.Setup(mock => mock.CreateReadOnlyShared(It.IsAny <string>())).Returns(_stream); var handler = new HostsFileHandler(_mockFactory.Object); var lines = handler.Read(); Assert.Equal(23, lines.Count); }
public void Read_ShouldCreateReadOnlyStream() { _stream = new MemoryStream(Encoding.UTF8.GetBytes(Resources.SampleFileData)); _mockFactory.Setup(mock => mock.CreateReadOnlyShared(It.IsAny <string>())).Returns(_stream); var handler = new HostsFileHandler(_mockFactory.Object); handler.Read(); _mockFactory.Verify(mock => mock.CreateReadOnlyShared(It.IsAny <string>()), Times.Once); }