public void RavenDBRepository_GetAll_Returns_List_Of_Models() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); IEnumerable<Dog> dogs; using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession()) { var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object); //Act dogs = repository.GetAll(); } //Assert Thread.Sleep(5000); var listOfDogs = dogs.ToList(); for (int i = 0; i < listOfDogs.Count(); i++) { Assert.IsInstanceOf<Dog>(listOfDogs[i]); } }
public void RavenDBRepository_GetAll_Returns_Models_With_Correct_Properties() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); IEnumerable<Dog> dogs; using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession()) { var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object); //Act dogs = repository.GetAll(); } //Assert Thread.Sleep(5000); var dog = dogs.First(); Assert.AreEqual(_dogAges[0], dog.Age.ToString()); Assert.AreEqual(_dogNames[0], dog.Name); }
public void RavenDBRepository_GetAll_Returns_All_Rows(int count) { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(count); IEnumerable<Dog> dogs; using (IDocumentSession _ravenDB = RavenDBDocumentStore.Instance.OpenSession()) { var repository = new RavenDBRepository<Dog>(_ravenDB, mockCache.Object); //Act dogs = repository.GetAll(); } //Assert Thread.Sleep(5000); Assert.AreEqual(count, dogs.Count()); }