Exemple #1
0
 public IActionResult Create(SimpleText simpleText)
 {
     if (ModelState.IsValid)
     {
         _simpleTextService.Create(simpleText);
         _simpleTextService.Commit();
         return(RedirectToAction("Index"));
     }
     return(View(simpleText));
 }
Exemple #2
0
        public void Create_CreatingSimpleText_ShouldCreateSimpleText()
        {
            // Arrange
            var entity = new SimpleText
            {
                Name = "Test"
            };
            var before = _db.SimpleTexts.Count();

            // Act
            _service.Create(entity);
            _service.Commit();

            // Assert
            Assert.Equal(1, _db.SimpleTexts.Count() - before);
        }