Ejemplo n.º 1
0
        public void OnAutoAfgemeld(AutoKlaargemeldEvent autoKlaargemeldEvent)
        {
            if (autoKlaargemeldEvent.IsApk)
            {
                var garage = new Garage()
                {
                    GarageNaam = "Jomaya",
                    PlaatsNaam = "Utrecht",
                };
                autoKlaargemeldEvent.EigenaarNaam = GetEigenaarNaamFromKlantService(autoKlaargemeldEvent.KlantId);
                _service.Createmessage(autoKlaargemeldEvent, garage);

                var builder = new StringBuilder();

                builder.Append($"TimeStamp: {autoKlaargemeldEvent.TimeStamp} ");
                builder.Append($"Guid: {autoKlaargemeldEvent.GUID} ");
                builder.Append($"AutoID: {autoKlaargemeldEvent.AutoId} ");
                builder.Append($"Eigenaar: {autoKlaargemeldEvent.EigenaarNaam} ");
                builder.Append($"Kenteken: {autoKlaargemeldEvent.Kenteken} ");
                builder.Append($"KilometerStand: {autoKlaargemeldEvent.KilometerStand} ");
                builder.Append($"VoertuigType: personenauto ");

                LogToFile(builder.ToString());
            }
        }
Ejemplo n.º 2
0
        public void CreateMessagePublishedEventOfRDWResponse()
        {
            var publisherMock = new Mock <IEventPublisher>(MockBehavior.Strict);

            publisherMock.Setup(pub => pub.Publish(It.IsAny <DomainEvent>()));
            var testEvent = new AutoKlaargemeldEvent()
            {
                VoertuigType = (int)VoertuigTypes.Personenauto, Kenteken = "AB-BA-22", KilometerStand = 1234, EigenaarNaam = "J. jansen", AutoId = 1, GUID = Guid.NewGuid().ToString(), RoutingKey = "", TimeStamp = DateTime.UtcNow
            };
            Garage testGarage = new Garage()
            {
                GarageNaam = "Jomaya", PlaatsNaam = "Utrecht"
            };

            using (var target = new RDWService(publisherMock.Object))
            {
                target.Createmessage(testEvent, testGarage);

                Thread.Sleep(1000);

                publisherMock.Verify(pub => pub.Publish(It.IsAny <DomainEvent>()), Times.Once());
            }
        }