예제 #1
0
        public void Add_TestObject_ShouldAdd()
        {
            ITestObjectRepository repo     = GetTestObjectRepository();
            TestObject            expected = new TestObject {
                Title       = "Add Test",
                Description = "Add Test Description",
                StatusID    = Status.Active,
                InputOn     = DateTime.Now,
                InputByID   = 1,
                IsActive    = true
            };

            repo.Add(expected);

            TestObject actual = repo.GetByTitle(expected.Title);

            Assert.IsNotNull(actual);      // Make sure object was returned
            Assert.AreNotEqual(0, actual); // Make sure autonumber was assigned
            Assert.IsTrue(expected.AllPropsEqual(actual), "The object returned from the database does not match the original");
        }
예제 #2
0
        public void Update_TestObject_ShouldUpdate()
        {
            ITestObjectRepository repo   = GetTestObjectRepository();
            TestObject            newObj = new TestObject {
                Title       = "Update Test",
                Description = "Update Test Description",
                StatusID    = Status.Active,
                InputOn     = DateTime.Now,
                InputByID   = 1,
                IsActive    = true
            };

            repo.Add(newObj);

            newObj.Title   += " - Updated";
            newObj.StatusID = Status.Closed;
            repo.Update(newObj);
            TestObject fromDB = repo.GetByID(newObj.ID);

            Assert.IsNotNull(fromDB); // Make sure object was returned
            Assert.IsTrue(newObj.AllPropsEqual(fromDB), "The object returned from the database does not match the updated original");
        }