Esempio n. 1
0
 public JsonResult Create([FromBody] ContentLimitItemViewModel contentLimitItemViewModel)
 {
     return(Json(_insuranceService.AddContentLimitItem(
                     new ContentLimitItem
     {
         Name = contentLimitItemViewModel.Name,
         Value = contentLimitItemViewModel.Value,
         ContentLimitCategoryId = contentLimitItemViewModel.ContentLimitCategoryId
     })));
 }
Esempio n. 2
0
        public void Should_Add_Content_Limit_Item()
        {
            //SETUP
            int categoryId        = 1;
            ContentLimitItem item = new ContentLimitItem()
            {
                Name = "TestName", Value = 100, ContentLimitCategoryId = categoryId
            };
            ContentLimitCategory category = new ContentLimitCategory()
            {
                CategoryName = "TestCategory", Id = categoryId
            };

            _mockContentLimitCategoryDao.Setup(m => m.Get(It.Is <int>(id => id == categoryId))).Returns(category);

            //TEST
            _sut.AddContentLimitItem(item);

            //VERIFY
            _mockContentLimitItemsDao.Verify(m => m.Add(It.IsAny <ContentLimitItem>()), Times.Once);
        }