Пример #1
0
		public void Setup()
		{
			SetupSandbox();

			_context = new Mock<INhContext>();
			_repository = new Mock<IDataRepository<Session>>();
			_publishService = new Mock<IPublishService>();
			_ioService = new Mock<IIOService>();
			_logger = new Mock<NuGetAlias::NuGet.Logging.ILogger>();
			_console = new Mock<IConsole>();
			_session = new NhSession();

			_context.Setup(c => c.AppSettings).Returns(new NameValueCollection());
			_context.Setup(c => c.Session).Returns(_session);
			_repository.Setup(r => r.Find(It.IsAny<Guid>())).Returns(new Session());

			_dataPath = GetContextProperty("data").ToString();
			_resultPath = GetContextProperty("result").ToString();
			_ioService.Setup(i => i.GetFiles(It.IsAny<string>(), It.IsAny<string>(), SearchOption.AllDirectories))
				.Returns<string, string, SearchOption>(Directory.GetFiles);
			_ioService.Setup(i => i.IsExistFile(It.IsAny<string>()))
				.Returns<string>(File.Exists);
			_ioService.Setup(i => i.GetFileExtension(It.IsAny<string>()))
				.Returns<string>(Path.GetExtension);
			_ioService.Setup(i => i.CombinePath(It.IsAny<string>(), It.IsAny<string>()))
				.Returns<string, string>(Path.Combine);
			_ioService.Setup(i => i.GetDirectoryName(It.IsAny<string>()))
				.Returns(_resultPath);
			_ioService.Setup(i => i.CreateFile(It.IsAny<string>()))
				.Returns<string>(File.Create);
		}
Пример #2
0
 public void Setup()
 {
     _tracer = new Mock<ITracer>();
     _sessionId = Guid.NewGuid();
     _session = new NhSession {Id = _sessionId};
     _appSettings = new NameValueCollection();
     _message = "trjam message";
     _data = "fake data bla bla";
 }