예제 #1
0
        public void TestCreateLegacyClientWithoutVersionCheck()
        {
            var clientConfig = new ClientConfig
            {
                BindingType = ServiceBindingType.BasicHttp,
                Endpoint    = "LogMaintenance",
                Host        = "localhost",
                Port        = 80,
            };

            _versionServiceManager.EnableVersionService = false;

            _wcfClientFactory.Create <LogMaintenanceClientMock, ILogMaintenance>(clientConfig, LogMaintenanceCallback);

            _connectedEvent.Wait(MediumWait);
            _allClientsConnectedEvent.Wait(ShortWait);

            Assert.IsTrue(_connectedEvent.IsSet, "Not connected.");
            Assert.IsTrue(_allClientsConnectedEvent.IsSet, "Not all connected.");
            Assert.AreEqual(3, _receivedClientInfos.Count);

            Assert.NotNull(_receivedClientInfos.FirstOrDefault(i => i.Service == LogMaintenanceServiceName && i.State == ConnectionState.New && i.Tries == 0), "Received initial {0} client info event", LogMaintenanceServiceName);
            Assert.NotNull(_receivedClientInfos.FirstOrDefault(i => i.Service == LogMaintenanceServiceName && i.State == ConnectionState.New && i.Tries == 1), "Received intermediate {0} client info event", LogMaintenanceServiceName);
            Assert.NotNull(_receivedClientInfos.FirstOrDefault(i => i.Service == LogMaintenanceServiceName && i.State == ConnectionState.Success && i.Tries == 1), "Received final {0} client info event", LogMaintenanceServiceName);
        }
        public void CreateLegacyClientThrowsArgumentException(bool configNull, string endpoint, int port)
        {
            var config = CreateLegacyConfig(configNull, endpoint, port);

            Assert.Throws <ArgumentException>(delegate
            {
                _wcfClientFactory.Create <LogMaintenanceClientMock, ILogMaintenance>(config, LogMaintenanceCallback);
            });
        }