Exemplo n.º 1
0
        public void SaveByKeySavesChanges()
        {
            CatalogService svc            = GetTestCatalogService(nameof(SaveByKeySavesChanges), out DaoRepository daoRepository);
            string         name           = "part of the composite key so it must not change";
            string         originalValue  = "original value";
            string         updatedValue   = "updated value";
            ItemDefinition itemDefinition = new ItemDefinition()
            {
                Name = name, Description = originalValue
            };

            itemDefinition = itemDefinition.SaveByKey <ItemDefinition>(daoRepository);
            Expect.AreEqual(originalValue, itemDefinition.Description);
            Expect.AreEqual(name, itemDefinition.Name);

            itemDefinition.Description = updatedValue;
            itemDefinition             = itemDefinition.SaveByKey <ItemDefinition>(daoRepository);

            Expect.AreEqual(updatedValue, itemDefinition.Description);
            Expect.AreEqual(name, itemDefinition.Name);
        }