public PlotQueryResultDto(PlotEntity plotEntity) { this.EventCode = plotEntity.EventCode.ToString(); this.Lat = plotEntity.Lat; this.Lon = plotEntity.Lon; this.VId = plotEntity.VId; this.TimeStamp = plotEntity.TimeStamp; }
public Task <bool> Add(PlotEntity plotEntity) { var key = this.GetKey(plotEntity); base.Add(key, plotEntity); this.numPlots++; return(Task.FromResult(true)); }
public void RegisterMovementSuccess() { var entity = new PlotEntity(Vehicleid, 11, 11, DateTime.Now, EventCode.Movement); this.plotAppService.Register(entity); this.emitter.Received(1).Emit(Arg.Any <RegisterPlotEvent>()); }
private PlotEntity GeneratePlot(int vehicleId, EventCode eventCode) { var plotEntity = new PlotEntity(vehicleId, this.coordinates, this.coordinates, DateTime.Now, eventCode); this.coordinates++; return(plotEntity); }
public void RegisterIgnitionOnSuccess() { var entity = new PlotEntity(Vehicleid, 10, 10, DateTime.Now, EventCode.IgnitionOn); this.plotAppService.Register(entity); this.emitter.Received(1).Emit(Arg.Any <RegisterPlotEvent>()); }
public Task Register(PlotEntity plotEntity) { this.logger.LogTrace("Registering Event"); this.eventEmitter.Emit(new RegisterPlotEvent(plotEntity)); this.logger.LogTrace("Registered Event"); return(Task.CompletedTask); }
public async Task CreateFirstEventSuccess() { PlotEntity plotEntity = null; this.plotAppService.When(method => method.Register(Arg.Any<PlotEntity>())).Do(args => plotEntity = (PlotEntity)args[0]); await this.senderService.GenerateRandomPlot(Vehicleid); Assert.NotNull(plotEntity); Assert.Equal(EventCode.IgnitionOn, plotEntity.EventCode); }
private PlotQueryResultDto PlotEntityToPlotQueryResultDto(PlotEntity plotEntity, ref DateTime?lastIgnitionOn) { var result = new PlotQueryResultDto(plotEntity); switch (plotEntity.EventCode) { case EventCode.IgnitionOn: result.JourneyStart = plotEntity.TimeStamp; lastIgnitionOn = plotEntity.TimeStamp; break; case EventCode.IgnitionOff: result.JourneyStart = lastIgnitionOn; result.JourneyEnd = plotEntity.TimeStamp; lastIgnitionOn = null; break; case EventCode.Movement: result.JourneyStart = lastIgnitionOn; break; } return(result); }
private async Task <bool> EventMovementReceived(PlotEntity entity) { return(await this.plotRepository.Add(entity)); }
private async Task <bool> EventIgnitionOnReceived(PlotEntity entity) { return (await this.plotRepository.AddIgnitionOn(entity.VId, entity.TimeStamp) && await this.plotRepository.Add(entity)); }
public RegisterPlotEvent(PlotEntity entity) { this.Entity = entity; }
private string GetKey(PlotEntity plotEntity) { return(this.GetKey(plotEntity.VId, plotEntity.TimeStamp)); }
private string GetKey(PlotEntity plotEntity) { return(this.GetKey(plotEntity.VId)); }
public async Task <bool> Add(PlotEntity plotEntity) { var key = this.GetKey(plotEntity); return(await this.redis.AddSet(key, plotEntity, plotEntity.TimeStamp.ToOADate())); }