Beispiel #1
0
        public void GetAllReference_SavedObject_ShouldReturnCachedObject()
        {
            var book = new Book();

            BookRepository.Save(book);
            var version = new BookVersion {
                BookId = book.Id
            };

            BookVersionRepository.Save(version);

            var result = BookVersionRepository.GetAllReference <Book>(book.Id);

            Assert.AreSame(version, result.First());
        }
Beispiel #2
0
        public void GetAllReference_NotCachedObject_ShouldUpdateCache()
        {
            var book = new Book();

            BookRepository.Save(book);
            var version = new BookVersion {
                BookId = book.Id
            };

            NoCachedBookVersionRepository.Save(version);

            version = BookVersionRepository.GetAllReference <Book>(book.Id).First();
            var result = BookVersionRepository.GetAllReference <Book>(book.Id);

            Assert.AreEqual(version, result.First());
        }