This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.IO.Fakes; | |
| using Microsoft.QualityTools.Testing.Fakes; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace FakesDemo.Tests | |
| { | |
| [TestClass] | |
| public class FileHelperTests | |
| { | |
| [TestMethod] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class FileHelper | |
| { | |
| public static bool IsValid(string fileName) | |
| { | |
| return File.ReadAllText(fileName).Length > 0; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestMethod] | |
| public void Ctor_WhenShouldBeNow() | |
| { | |
| using (ShimsContext.Create()) | |
| { | |
| ShimDateTime.NowGet = () => new DateTime(2012, 09, 06); | |
| var entry = new LogEntry("Hello World!"); | |
| Assert.AreEqual(DateTime.Now, entry.When); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LogEntry | |
| { | |
| class DefaultCurrentDateProvider | |
| : ICurrentDateProvider | |
| { | |
| public DateTime GetCurrentDate() | |
| { | |
| return DateTime.Now; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LogEntry | |
| { | |
| public LogEntry(string message, IOutput output = null) | |
| { | |
| this.When = DateTime.Now; | |
| this.Message = message; | |
| if (output != null) | |
| output.Write(this); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Text; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Sockets; | |
| namespace MyHttpServer | |
| { | |
| class SimpleHttpServer | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var image = new Image(); | |
| image.src = "../images/smurf_sprite.png"; | |
| $(image).load(function () { | |
| animate(); | |
| }); | |
| function animate() { | |
| update(); | |
| draw(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var query = ( | |
| from address in addresses | |
| from order in orders | |
| where address.AddressID == order.Address.AddressID | |
| && address.City == "Seattle" | |
| orderby order.SalesOrderID | |
| select new | |
| { | |
| City = address.City, | |
| OrderID = order.SalesOrderID, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IFoo f1 = new SomeConcreteFoo(); | |
| var f2 = (IFoo) (new SomeConcreteFoo()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var account = new Account(); | |
| var tasks = new Task[10]; |