コード例 #1
0
        public void NewEntryWithValidData()
        {
            EntryDataDTO entryNew;

            _userService.SetUser(_regularUser1);
            _controller.Create(entryNew = new EntryDataDTO()
            {
                DistanceInMeters = 101,
                TimeInSeconds    = 102,
                UserId           = _regularUser1.Id,
                Date             = new DateTime(2020, 1, 1)
            });

            var res = ((_controller.Get(entryNew.Date, entryNew.Date, _regularUser1.Id) as OkObjectResult).Value as IEnumerable <EntryDTO>).ToArray();

            Assert.AreEqual(entryNew.DistanceInMeters, res.Single().DistanceInMeters);
            Assert.AreEqual(entryNew.TimeInSeconds, res.Single().TimeInSeconds);
            Assert.AreEqual(entryNew.Date, res.Single().Date);
        }