Exemplo n.º 1
0
        public void testFilmCaching()
        {
            var testProv = new TestProvider {
                Films = new List <Film> {
                    new Film {
                        Title = "testTitle"
                    }
                }
            };
            var cachingProvider = new CashingProvider(testProv);

            var films1 = cachingProvider.GetFilms();

            Assert.AreEqual(1, testProv.GetFilmsCounter);

            var films2 = cachingProvider.GetFilms();

            Assert.AreEqual(1, testProv.GetFilmsCounter);
            Assert.AreEqual(films1, films2);
        }
Exemplo n.º 2
0
        public void testCharacterCaching()
        {
            var testProv = new TestProvider {
                Characters = new List <Character> {
                    new Character {
                        Name = "testName"
                    }
                }
            };
            var cachingProvider = new CashingProvider(testProv);

            var characters1 = cachingProvider.GetCharacters();

            Assert.AreEqual(1, testProv.GetCharacterCounter);

            var characters2 = cachingProvider.GetCharacters();

            Assert.AreEqual(1, testProv.GetCharacterCounter);

            Assert.AreEqual(characters1, characters2);
        }