コード例 #1
0
        public async Task GetRouteCurrentLatency_WhenTracesExistAndAreBefore_ReturnsOkObjectResult()
        {
            DateAndTime.NowImpl = () => new DateTime(1980, 1, 1, 12, 15, 0);

            await Context.BusStopTraces.AddAsync(new BusStopTrace
            {
                Id        = 100,
                Date      = DateAndTime.Now.Date,
                Hour      = new TimeSpan(12, 10, 0),
                BusStopId = 1
            });

            await Context.SaveChangesAsync();

            var response = await _routesController.GetRouteCurrentLatency(1);

            var resultObject = response as OkObjectResult;
            var result       = (int)resultObject.Value;

            Assert.IsInstanceOf <OkObjectResult>(response);
            Assert.AreEqual(10, result);
        }