Пример #1
0
        public void TestProhibitPublishing()
        {
            var mock          = new Mock <IPluginRepository>();
            var configuration = new ServerConfiguration
            {
                Publishing = { AllowRemotePublish = false }
            };
            var proxy = new PluginRepositoryProxy(mock.Object, configuration);

            new Action(() => proxy.PublishPlugin(new byte[1234], "a"))
            .Should()
            .Throw <RemotePublishDisabledException>();
            mock.Verify(x => x.PublishPlugin(It.IsAny <byte[]>(), It.IsAny <string>()),
                        Times.Never);
        }
Пример #2
0
        protected override void OnStart(string[] args)
        {
            Log.DebugFormat("Starting...");

            try
            {
                var configuration = ServerConfiguration.ReadOrCreate(Constants.ApplicationConfigurationFile);

                _repository = PluginRepository.Create();
                var repositoryProxy = new PluginRepositoryProxy(_repository, configuration);
                var ep = IPEndPointExtensions.Parse(configuration.Address);
                _server = new Server(ep, repositoryProxy);

                Log.InfoFormat("Started");
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Caught unexpected exception while trying to start: {0}", e);

                throw;
            }
        }