Пример #1
0
        public void CreateCovenantRepositoryTest()
        {
            //Arrange
            Covenant            b          = ObjectMother.GetCovenant();
            ICovenantRepository repository = new CovenantRepository();

            //Action
            Covenant newCovenant = repository.Save(b);

            //Assert
            Assert.IsTrue(newCovenant.Id > 0);
        }
Пример #2
0
        public void DeleteCovenantRepositoryTest()
        {
            //Arrange
            ICovenantRepository repository = new CovenantRepository();

            //Action
            var deletedCovenant = repository.Delete(1);

            //Assert
            var persistedCovenant = _contextForTest.Covenants.Find(1);

            Assert.IsNull(persistedCovenant);
        }
Пример #3
0
        public void RetrieveCovenantRepositoryTest()
        {
            //Arrange
            ICovenantRepository repository = new CovenantRepository();

            //Action
            Covenant Covenant = repository.Get(1);

            //Assert
            Assert.IsNotNull(Covenant);
            Assert.IsTrue(Covenant.Id > 0);
            Assert.IsFalse(string.IsNullOrEmpty(Covenant.Name));
            Assert.IsFalse(string.IsNullOrEmpty(Covenant.Business));
            Assert.IsFalse(string.IsNullOrEmpty(Covenant.Plan));
            Assert.IsFalse(Covenant.Coverage < 0);
        }
Пример #4
0
        public void UpdateCovenantRepositoryTest()
        {
            //Arrange
            ICovenantRepository repository = new CovenantRepository();
            Covenant            Covenant   = _contextForTest.Covenants.Find(1);

            Covenant.Name     = "Teste";
            Covenant.Business = "NDD";
            Covenant.Plan     = "0000";
            Covenant.Coverage = 20;

            //Action
            var updatedCovenant = repository.Update(Covenant);

            //Assert
            var persistedCovenant = _contextForTest.Covenants.Find(1);

            Assert.IsNotNull(updatedCovenant);
            Assert.AreEqual(updatedCovenant.Id, persistedCovenant.Id);
            Assert.AreEqual(updatedCovenant.Name, persistedCovenant.Name);
            Assert.AreEqual(updatedCovenant.Business, persistedCovenant.Business);
            Assert.AreEqual(updatedCovenant.Plan, persistedCovenant.Plan);
            Assert.AreEqual(updatedCovenant.Coverage, persistedCovenant.Coverage);
        }