public void ShimReadFileFakeTest() { using (Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()) { const string path = "cośtam123"; const string expected = "cośtamwpliku"; System.IO.Fakes.ShimFileStream.ConstructorStringFileMode = (@this, p, f) => { var shim = new System.IO.Fakes.ShimFileStream(@this); }; System.IO.Fakes.ShimStreamReader.ConstructorStream = (@this, s) => { var shim = new System.IO.Fakes.ShimStreamReader(@this) { ReadToEnd = () => expected }; }; var actual = LibraryShop.Read(path); Assert.AreEqual(expected, actual); } }