Exemplo n.º 1
0
 public void Initialize()
 {
     _deviceRepositoryMock   = DeviceRepositoryMock.GetDeviceRepositoryMock();
     _incidentRepositoryMock = IncidentRepositoryMock.GetIncidentRepositoryMock();
     _deviceManipulation     = new DeviceManipulation(
         _deviceRepositoryMock.Object,
         _incidentRepositoryMock.Object
         );
     _incidentRepositoryMock.Setup(x => x.GetAllIncidents(1)).Returns(GetListOfValidIncidentDomains());
 }
Exemplo n.º 2
0
        public void Initialize()
        {
            // Queue setup
            var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                var host = cfg.Host(new Uri(ConfigurationManager.AppSettings["rabbitMQHostUri"].ToString()), h =>
                {
                    h.Username(ConfigurationManager.AppSettings["rabbitMQUsername"].ToString());
                    h.Password(ConfigurationManager.AppSettings["rabbitMQPassword"].ToString());
                });

                // Define message queues and bind consumers to queue here
                cfg.ReceiveEndpoint(host, "message_log_queue", e =>
                {
                    e.Consumer <LogMessageReceivedConsumer>();
                });

                cfg.ReceiveEndpoint(host, "device_ping_queue", e =>
                {
                    e.Consumer <DevicePingReceivedConsumer>();
                });
            });

            _devicePingRepositoryMock = DevicePingRepositoryMock.GetDevicePingRepositoryMock();
            _deviceRepositoryMock     = DeviceRepositoryMock.GetDeviceRepositoryMock();
            _incidentRepositoryMock   = IncidentRepositoryMock.GetIncidentRepositoryMock();

            _deviceManipulation = new DeviceManipulation(
                _deviceRepositoryMock.Object,
                _incidentRepositoryMock.Object
                );

            _devicePingManipulation = new DevicePingManipulation(
                _devicePingRepositoryMock.Object,
                _deviceManipulation,
                busControl
                );
        }