コード例 #1
0
 public void EditAndSaveEntry()
 {
     if (!string.IsNullOrWhiteSpace(this.tb_Name.Text))
     {
         var entryLogic = new EntryLogic();
         entryLogic.UpdateEntry(this.entry_id.Value, new EntryUpdateParam {
             Name = this.tb_Name.Text, Comment = this.tb_Description.Text
         });
         entryLogic.Dispose();
         this.Close();
     }
 }
コード例 #2
0
        public void UpdateEntry_Test()
        {
            // ARRANGE
            CreateEntries();
            var entryLogic  = new EntryLogic();
            var updateParam = new EntryUpdateParam
            {
                Comment = "Test comment updated",
                Name    = "Test name updated"
            };

            // ACT
            entryLogic.UpdateEntry(1, updateParam);
            entryLogic.Dispose();
            this.uow.Dispose();
            this.uow = new UnitOfWork();

            // ASSERT
            var updatedEntry = this.uow.Entries.Get(1);

            Assert.IsNotNull(updatedEntry);
            Assert.AreEqual("Test comment updated", updatedEntry.Comment);
            Assert.AreEqual("Test name updated", updatedEntry.Name);
        }