示例#1
0
        public void Update_UpdatingSimpleText_ShouldUpdateSimpleText()
        {
            // Arrange

            var entity = new SimpleText
            {
                Name = "Test"
            };

            _db.SimpleTexts.Add(entity);
            _db.SaveChanges();
            var before = _db.SimpleTexts.Count();

            // Act
            entity      = _service.GetAll().FirstOrDefault();
            entity.Name = "Another name";
            _service.Update(entity);
            _db.SaveChanges();

            // Assert
            Assert.Equal(before, _db.SimpleTexts.Count());
            Assert.Equal("Another name", _db.SimpleTexts.FirstOrDefault().Name);
        }
示例#2
0
 // GET: SimpleText
 public IActionResult Index()
 {
     return(View(_simpleTextService.GetAll()));
 }