Beispiel #1
0
        public override object Update(Type type, object toUpdate)
        {
            toUpdate = DaoRepository.Update(type, toUpdate);
            FileInfo yamlFile = YamlDataDirectory.GetYamlFile(type, toUpdate);

            if (yamlFile != null)
            {
                YamlDataDirectory.Save(yamlFile, type, toUpdate);
            }
            return(toUpdate);
        }
Beispiel #2
0
        public void RepositoryUpdateShouldSetNewPropertyValues()
        {
            DaoRepository repo     = GetTestDaoRepository();
            TestContainer toCreate = new TestContainer();
            string        testName = "Test Name".RandomLetters(5);

            toCreate.Name     = testName;
            toCreate.BirthDay = DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0));
            toCreate          = repo.Create(toCreate);
            TestContainer toUpdate = repo.Retrieve <TestContainer>(toCreate.Id);
            string        newName  = "New Name".RandomLetters(8);

            toUpdate.Name = newName;
            DateTime newBirthDay = DateTime.Now.Subtract(new TimeSpan(14, 0, 0, 0));

            toUpdate.BirthDay = newBirthDay;
            toUpdate          = repo.Update(toUpdate);
            TestContainer check = repo.Retrieve <TestContainer>(toCreate.Id);

            Expect.AreEqual(newName, check.Name);
            Expect.AreEqual(newBirthDay.Trim(), check.BirthDay.Trim());
            Expect.AreEqual(toCreate.Id, check.Id);
        }