public void Init()
        {
            _service = A.Fake<IRunAsService>();
            _settings = new XmlConfig.XmlConfig();
            _settings.LoadXmlFromString("<configuration><restart><times value=\"2\" /></restart></configuration>");

            _repository = new HookRepository("RestartHook", _settings, _service);
            _repository.Hooks.Should().HaveCount(1);
            _repository.Hooks[0].Should().BeOfType<RestartHook>();
        }
示例#2
0
        public void Init()
        {
            // provide a good configuration
            _settings = new XmlConfig.XmlConfig();
            _settings.LoadXmlFromString("<configuration><description>" + Description + "</description><displayName>" +
                                        DisplayName + "</displayName><name>" + Name + "</name><executable>" + Executable +
                                        "</executable></configuration>");

            // Set the fake process related to the service
            _command = A.Fake<ICommand>();
            _commandBuilder = A.Fake<CommandBuilder>();
            A.CallTo(() => _commandBuilder.BuildCommand(_settings, Name)).Returns(_command);

            // Make a hook and add it in the repository
            _hook = A.Fake<IExitHook>();
            _repository = A.Fake<HookRepository>();
            A.CallTo(() => _repository.Hooks).Returns(new List<IExitHook> {_hook});

            _service = new RunAsService(_settings, _repository, _commandBuilder);
        }