public void CreatesCorrectPathAndCheckums() { string filePath = "supyo.txt"; var ms = new MemoryStream(someData); var mockedServerUtility = new Mock <HttpServerUtilityBase>(); mockedServerUtility.Setup(x => x.MapPath(It.IsAny <string>())).Returns(filePath); var mockedHttpCtx = new Mock <HttpContextBase>(); mockedHttpCtx.SetupGet(x => x.Server).Returns(mockedServerUtility.Object); var mockedFSW = new Mock <IFileWatcherService>(); mockedFSW.Setup(x => x.CreateFileSystemWatcher(It.IsAny <string>())) .Returns(Mock.Of <FileSystemWatcherBase>()); var mockedFS = new Mock <IFileSystem>(); mockedFS.Setup(x => x.File.Exists(It.IsAny <string>())).Returns(true); mockedFS.Setup(x => x.File.OpenRead(It.IsAny <string>())).Returns(ms); var container = LightInjectActivator.Start(); container.RegisterInstance(mockedHttpCtx.Object); container.RegisterInstance(mockedFS.Object); container.RegisterInstance(mockedFSW.Object); var result = Versioning.AddChecksum(filePath); Assert.AreEqual( "supyo.txt?v=B6904CA20CF3967B8525DA9D19D7C5F90003524E3082FA0926EF3FE3148CC712", result ); }
public void ResolvesInstance() { var container = LightInjectActivator.Start(); container.RegisterInstance(Mock.Of <HttpContextBase>()); var v = Versioning.Instance; }