Exemple #1
0
        public void CanMapContractsToQueueNameAndMachineName()
        {
            const string QueueName   = "RemoteQueue";
            const string MachineName = "RemoteMachine";

            var remoteEndpointAddress = new EndpointAddress(QueueName, MachineName);

            var configuration        = A.Fake <IConfigureThisJitney>();
            var localEndpointAddress = new EndpointAddress("local");
            var contractMap          = new Dictionary <Type, EndpointAddress>();
            var assembly             = typeof(MyCommand).Assembly;

            var testee = new ContractsToEndpointMapper(configuration, localEndpointAddress, contractMap, assembly);

            var result = testee.To(QueueName, MachineName);

            contractMap.Should()
            .Contain(typeof(MyCommand), remoteEndpointAddress).And
            .Contain(typeof(OtherCommand), remoteEndpointAddress).And
            .Contain(typeof(MyEvent), remoteEndpointAddress).And
            .Contain(typeof(OtherEvent), remoteEndpointAddress).And
            .Contain(typeof(MyMessage), remoteEndpointAddress).And
            .Contain(typeof(OtherMessage), remoteEndpointAddress);

            result.Should().Be(configuration);
        }
Exemple #2
0
        public void CanMapContractsToTheLocalEndpoint()
        {
            var configuration        = A.Fake <IConfigureThisJitney>();
            var localEndpointAddress = new EndpointAddress("local");
            var contractMap          = new Dictionary <Type, EndpointAddress>();
            var assembly             = typeof(MyCommand).Assembly;

            var testee = new ContractsToEndpointMapper(configuration, localEndpointAddress, contractMap, assembly);

            var result = testee.ToMe();

            contractMap.Should()
            .Contain(typeof(MyCommand), localEndpointAddress).And
            .Contain(typeof(OtherCommand), localEndpointAddress).And
            .Contain(typeof(MyEvent), localEndpointAddress).And
            .Contain(typeof(OtherEvent), localEndpointAddress).And
            .Contain(typeof(MyMessage), localEndpointAddress).And
            .Contain(typeof(OtherMessage), localEndpointAddress);

            result.Should().Be(configuration);
        }