Beispiel #1
0
        public async Task Should_find_all_vehicle_plots(int id, double start, double stop)
        {
            //Arrange
            _database.Setup(x => x.SortedSetRangeByScoreAsync(It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>(), It.IsAny <Exclude>(),
                                                              It.IsAny <Order>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CommandFlags>()))
            .ReturnsAsync(new RedisValue[] { });

            var Sut = new VehiclePlotDao(_connectionMultiplexer.Object);

            //Act
            await Sut.FindAllVehiclePlotsAsync(id, start, stop);

            //Assert
            _database.Verify(x => x.SortedSetRangeByScoreAsync($"vehicle-plot-delivery:vehicle:{id}", start, stop, Exclude.None, Order.Ascending, 0, -1, CommandFlags.None));
        }
Beispiel #2
0
        public async Task Should_insert_vehicle_plot(int id, string definition, double score)
        {
            //Arrange
            _database.Setup(x => x.SortedSetAddAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <double>(), It.IsAny <When>(), It.IsAny <CommandFlags>()));

            var vehiclePlotDto = new VehiclePlotDto
            {
                Id         = id,
                Definition = definition,
                Score      = score
            };

            var Sut = new VehiclePlotDao(_connectionMultiplexer.Object);

            //Act
            await Sut.InsertAsync(vehiclePlotDto);

            //Assert
            _database.Verify(x => x.SortedSetAddAsync($"vehicle-plot-delivery:vehicle:{vehiclePlotDto.Id}", vehiclePlotDto.Definition, vehiclePlotDto.Score,
                                                      When.Always, CommandFlags.None));
        }