Ejemplo n.º 1
0
        public void RavenDBRepository_Update_Updates_Item_With_Correct_ID()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(TestConstants.PETAPOCO_RecordCount);

            using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession())
            {
                var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object);
                var dog = new Dog
                {
                    ID = TestConstants.PETAPOCO_UpdateDogId,
                    Age = TestConstants.PETAPOCO_UpdateDogAge,
                    Name = TestConstants.PETAPOCO_UpdateDogName
                };

                //Act
                repository.Update(dog);
            }

            //Assert
            //DataTable table = DataUtil.GetTable(TestConstants.PETAPOCO_DatabaseName, TestConstants.PETAPOCO_TableName);
            //foreach (DataRow row in table.Rows)
            //{
            //    if ((int)row["ID"] == TestConstants.PETAPOCO_UpdateDogId)
            //    {
            //        Assert.AreEqual(row["Age"], TestConstants.PETAPOCO_UpdateDogAge);
            //        Assert.AreEqual(row["Name"], TestConstants.PETAPOCO_UpdateDogName);
            //    }
            //}
            Assert.IsTrue(false);
        }
Ejemplo n.º 2
0
        public void RavenDBRepository_Update_Updates_Item_In_DataBase()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(TestConstants.PETAPOCO_RecordCount);

            using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession())
            {
                var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object);
                var dog = new Dog
                {
                    ID = TestConstants.PETAPOCO_UpdateDogId,
                    Age = TestConstants.PETAPOCO_UpdateDogAge,
                    Name = TestConstants.PETAPOCO_UpdateDogName
                };

                //Act
                repository.Update(dog);
            }

            //Assert
            //int actualCount = DataUtil.GetRecordCount(TestConstants.PETAPOCO_DatabaseName,
            //    TestConstants.PETAPOCO_TableName);
            //Assert.AreEqual(TestConstants.PETAPOCO_RecordCount, actualCount);
            Assert.IsTrue(false);
        }