예제 #1
0
        public void Update_modifies_item_in_db()
        {
            var changedData = new Gutachter
            {
                Id       = 2,
                Nachname = "TEST",
                Vorname  = "TEST",
                EMail    = "*****@*****.**"
            };

            _sut.Update(changedData);

            Gutachter vorherKlaus = _inMemoryDbSet.First(x => x.Id == 2);

            Assert.That(vorherKlaus.Vorname, Is.EqualTo(changedData.Vorname), "Vorname should change");
            Assert.That(vorherKlaus.Nachname, Is.EqualTo(changedData.Nachname), "Nachname should change");
            Assert.That(vorherKlaus.EMail, Is.EqualTo(changedData.EMail), "EMail should change");
            Assert.That(vorherKlaus.Gutachten.Count, Is.EqualTo(1), "Gutachten should not be changed");

            _mockedContext.Verify(x => x.SaveChanges(), Times.Once());
        }