示例#1
0
        public void RavenDBRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(5);

            Dog dog;
            using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession())
            {
                var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object);

                //Act
                dog = repository.GetById(TestConstants.PETAPOCO_InvalidDogId);
            }

            //Assert
            Thread.Sleep(5000);
            Assert.IsNull(dog);
        }
示例#2
0
        public void RavenDBRepository_GetById_Returns_Model_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(5);

            Dog dog;
            using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession())
            {
                var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object);

                //Act
                dog = repository.GetById(TestConstants.PETAPOCO_ValidDogId);
            }

            //Assert
            Thread.Sleep(5000);
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogAge, dog.Age.ToString());
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogName, dog.Name);
        }