Ejemplo n.º 1
0
        public void WcfClient_with_no_name_and_failed_connection_should_return_name_as_Unknown()
        {
            var failingChannel = TestChannel.Create(r => { throw new EndpointNotFoundException(); });
            var subject        = new WcfClient(failingChannel);

            Assert.That(subject.Name, Is.EqualTo("Unknown"));
        }
Ejemplo n.º 2
0
        public void WcfClients_endpointaddress_should_return_the_inner_channels_endpoint()
        {
            var testUri     = "http://tesztUri.com/teszt".ToLowerInvariant();
            var testChannel = TestChannel.Create(null, testUri);
            var subject     = new WcfClient(testChannel);

            Assert.That(subject.EndpointAddress, Is.Not.Null);
            Assert.That(subject.EndpointAddress, Is.EqualTo(testUri));
        }
Ejemplo n.º 3
0
        public void WcfClient_with_no_name_set_should_connect_to_the_channel_to_get_name()
        {
            const string testBuildAgentName = "teszt-buildagent";
            var          testChannel        = TestChannel.Create(r => new BuildAgentPropertiesResponse {
                Name = testBuildAgentName
            });
            var subject = new WcfClient(testChannel);

            Assert.That(subject.Name, Is.EqualTo(testBuildAgentName));
        }
Ejemplo n.º 4
0
        public void Echomessage_should_return_a_failed_response_when_the_channel_fails()
        {
            var testChannel = TestChannel.Create(r =>
            {
                throw new EndpointNotFoundException();
            });

            var subject = new WcfClient(testChannel);

            var result = subject.EchoMessage("message");

            Assert.That(result.ResponseStatus, Is.EqualTo(ResponseStatus.Failure));
            Assert.IsNotInstanceOf <EchoResponse>(result);
        }
Ejemplo n.º 5
0
        public void EchoMessage_should_return_echoed_message_when_the_connection_is_okay()
        {
            const string echoedMessage = "teszt echo";
            var          testChannel   = TestChannel.Create(r => new EchoResponse {
                Message = echoedMessage
            });

            var subject = new WcfClient(testChannel);

            var result = subject.EchoMessage("message");

            Assert.That(result.ResponseStatus, Is.EqualTo(ResponseStatus.Success));
            Assert.IsInstanceOf <EchoResponse>(result);
            Assert.That(((EchoResponse)result).Message, Is.EqualTo(echoedMessage));
        }
Ejemplo n.º 6
0
        public void WcfClient_with_name_set_should_return_that_name()
        {
            var subject = new WcfClient(TestChannel.Create(null), "testname");

            Assert.That(subject.Name, Is.EqualTo("testname"));
        }