예제 #1
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();
        }
예제 #2
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();
        }