コード例 #1
0
		public void BeforeEachTest()
		{
			_readBody = new Mock<IApiReadBody>();
			_socket = new Mock<IApiSocket>();
			_config = new Mock<IConfigurationService>();
			_garbage = new Mock<IGarbage>();

			_req = new ApiRequest
				{
					Headers = new Hashtable(),
					GetArguments = new Hashtable(),
					Body = _readBody.Object,
					HttpMethod = "GET",
					Url = "auth/",
					Client = _socket.Object,
				};
			_sut = new AuthApiService(_config.Object, _garbage.Object);
		}
コード例 #2
0
        /*  public IWebServer BuildConfigurationNotAvailable(int port)
        {
            RequestHelper.SetLogger(_logger);
            return new WebServerNotAvailable(_logger, port);
        } */

        public IWebServer BuildConfigurationMode(int port)
        {
            var charDisp = _factory.CreateCharacterDisplay();
            var network = _factory.CreateNetworkWrapper();
            charDisp.Write("Config mode", network.IpAddress + ":" + port);

            RequestHelper.SetLogger(_logger);
            var webServer = new WebServer(_logger, _garbage, port);

            var authApiService = new AuthApiService(_configService, _garbage);
            var authResponder = new ApiServiceResponder(authApiService);
            webServer.AddResponse(authResponder);

            var configApiService = new ConfigApiService(_configService, _garbage);
            var configResponder = new ApiServiceResponder(configApiService);
            webServer.AddResponse(configResponder);

            var updateClient = new FilePutResponder(_rootDir, "client", _logger);
            webServer.AddResponse(updateClient);

            var fileServe = new FileGetResponder(_rootDir, "client", _logger);
            webServer.AddResponse(fileServe);

            return webServer;
        }