public void InitializeService()
        {
            #region mock repository & categoryRepository

            Note expectedNote = new Note { NoteId = 1, Title = "Test" };
            IEnumerable<Category> expectedListOfCategories = new List<Category>();

            this.repository = new Mock<IWebNoteRepository>();
            this.repository.Setup(r => r.GetNote(expectedNote.NoteId)).Returns(expectedNote);

            this.categoryRepository = new Mock<IWebNoteCategoryRepository>();
            this.categoryRepository.Setup(s => s.GetCategories(expectedNote.NoteId)).Returns(expectedListOfCategories);

            #endregion

            this.sut = new WebNoteService
                {
                    WebNoteRepository = this.repository.Object,
                    WebNoteCategoryRepository = this.categoryRepository.Object
                };

            #region clean HttpRuntime.Cache

            IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator();
            while (enumerator.MoveNext())
            {
                HttpRuntime.Cache.Remove(enumerator.Key.ToString());
            }
            #endregion
        }
        public void InitializeService()
        {
            this.repository = new Mock<IWebNoteRepository>();
            this.categoryRepository = new Mock<IWebNoteCategoryRepository>();

            this.webNoteService = new WebNoteService
            {
                WebNoteRepository = this.repository.Object,
                WebNoteCategoryRepository = this.categoryRepository.Object
            };
        }
Пример #3
0
        public void InitializeService()
        {
            #region mock repository & categoryRepository

            Note expectedNote = new Note { NoteId = 1, Title = "Test" };
            IEnumerable<Category> expectedListOfCategories = new List<Category>();

            this.repository = new Mock<IWebNoteRepository>();
            this.repository.Setup(r => r.GetNote(expectedNote.NoteId)).Returns(expectedNote);

            this.categoryRepository = new Mock<IWebNoteCategoryRepository>();
            this.categoryRepository.Setup(s => s.GetCategories(expectedNote.NoteId)).Returns(expectedListOfCategories);

            #endregion

            this.webNoteService = new WebNoteService
                {
                    WebNoteRepository = this.repository.Object,
                    WebNoteCategoryRepository = this.categoryRepository.Object
                };

            this.cache = new Cache("x");
            this.cache.CleanCompleteCache();
        }