Example #1
0
        public void InitialiseOpensTheWcfHost()
        {
            var channel = new Wcf();
            var address = "net.tcp://localhost/client";

            channel.Endpoints.Add(new NetTcp {
                Address = address
            });
            var opened = false;

            try
            {
                opened = channel.Initialise(null);
                Assert.IsTrue(opened);
                var connection = new ServerConnection(address, new NetTcpBinding());
                var canPing    = connection.Ping();
                Assert.IsTrue(canPing);
            }
            finally
            {
                if (opened)
                {
                    channel.CleanUp();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Main method.
        /// </summary>
        /// <param name="args">Command line arguments.</param>
        public static void Main(string[] args)
        {
            Wcf.WcfCalls();

            ////Wcf.AsmxCallsUsingWcf();

            ////Asmx.AsmxCallsUsingAsmxProxy();
        }
Example #3
0
        public void CleanUpCloseChannel()
        {
            var channel = new Wcf();

            channel.Endpoints.Add(new NetTcp {
                Address = "net.tcp://localhost/client"
            });
            channel.Initialise(null);
            channel.CleanUp();
        }
Example #4
0
        public void ValidateReturnsWarningIfNoName()
        {
            var warningAdded = false;
            var channel      = new Wcf();
            var validator    = new ValidationLogStub
            {
                OnAddWarningMessage = (m, a) =>
                {
                    Assert.AreEqual("Channel does not have a name", m);
                    CollectionAssert.IsEmpty(a);
                    warningAdded = true;
                }
            };

            channel.Validate(validator);
            Assert.IsTrue(warningAdded);
        }
 private TResult RunTest<TResult>(IActionInvoker invoker, Func<ServerConnection, TResult> test)
 {
     var channel = new Wcf();
     var address = "net.tcp://localhost/client";
     channel.Endpoints.Add(new NetTcp { Address = address });
     var opened = false;
     try
     {
         opened = channel.Initialise(invoker);
         Assert.IsTrue(opened);
         var connection = new ServerConnection(address);
         return test(connection);
     }
     finally
     {
         if (opened)
         {
             channel.CleanUp();
         }
     }
 }
        public void WriteWcfChannel()
        {
            var channel = new Wcf("TestChannel");

            PerformSerialisationTest(channel, "WcfChannel");
        }
Example #7
0
        public void CleanUpDoesNothingIfNotOpen()
        {
            var channel = new Wcf();

            channel.CleanUp();
        }