Ejemplo n.º 1
0
        public void The_user_records_can_save_load_and_delete_records()
        {
            UserRecords records = new UserRecords();

            User saveUser = factory.Generate("gitty", "Gyn Mitty", false);

            records.Save(saveUser);

            User testUser = records.Load(saveUser.ID);

            Assert.True(testUser.IsActive);
            Assert.That(records.Count, Is.EqualTo(1));

            records.Delete(testUser.ID);
            Assert.That(records.Count, Is.EqualTo(0));
        }
Ejemplo n.º 2
0
        public void The_user_records_does_not_crash_when_given_empty_or_missing_parameters()
        {
            UserRecords records = new UserRecords();
            User        test    = records.Load("");

            Assert.True(test.IsEmpty);

            records.Delete("");
            try {
                records.Save(new User());
                Assert.Fail("Should not have saved an empty user");
            }
            catch (InvalidOperationException exception) {
                log.Info("Captured expected exception: " + exception.Message);
            }
            Assert.That(records.Count, Is.EqualTo(0));
        }