Esempio n. 1
0
        private static FoodlogDto Map(IFoodlog foodlog)
        {
            var foodlogDto = new FoodlogDto
            {
                Id       = _foodlogs.Max(u => u.Id) + 1,
                Amount   = foodlog.Amount,
                Article  = foodlog.Article,
                DateTime = foodlog.DateTime,
                Unit     = foodlog.Unit,
                User     = foodlog.User
            };

            return(foodlogDto);
        }
Esempio n. 2
0
        public void FoodLog_Add_FoodlogShouldNotBeAdded_ValidationError()
        {
            var user = new UserDto
            {
                Id = 1,
            };
            var foodlog = new FoodlogDto
            {
                Amount   = 5,
                DateTime = DateTime.Now,
                Article  = null,
                Dish     = null,
                User     = new UserLogic().GetBy(user.Id, user.Id),
                Unit     = Unit.Stuks
            };

            var expected = false;
            var actual   = _foodlogLogic.Add(user.Id, foodlog);

            Assert.AreEqual(expected, actual);
        }