コード例 #1
0
        public void GetAllDecksTest()
        {
            var sut = new CatalogBll(this.catalog.Object, this.converter.Object);

            var actual = sut.GetAllDecks();

            this.catalog.Verify(
                cat => cat.GetAllDecks(),
                Times.Exactly(1));
            Assert.That(actual, Is.All.InstanceOf(typeof(DeckDTO)));
            Assert.AreEqual(decks.Count, actual.Count());
        }
コード例 #2
0
        public void GetAllCoursesTest()
        {
            var sut = new CatalogBll(this.catalog.Object, this.converter.Object);

            var actual = sut.GetAllCourses();

            this.catalog.Verify(
                cat => cat.GetAllCourses(),
                Times.AtLeastOnce());
            Assert.That(actual, Is.All.InstanceOf(typeof(CourseDTO)));
            Assert.AreEqual(courses.Count, actual.Count());
        }
コード例 #3
0
        public void GetAllDecksByCourseTest()
        {
            var sut = new CatalogBll(this.catalog.Object, this.converter.Object);

            foreach (var course in courses)
            {
                var actual = sut.GetAllDecksByCourse(course.Name);
                this.catalog.Verify(
                    cat => cat.GetAllDecksByCourse(course.Name),
                    Times.AtLeastOnce());
                Assert.That(actual, Is.All.InstanceOf(typeof(DeckDTO)));
            }
        }
コード例 #4
0
        public void GetAllCoursesByCategoryTest()
        {
            var sut = new CatalogBll(this.catalog.Object, this.converter.Object);

            foreach (var category in categories)
            {
                var actual = sut.GetAllCoursesByCategory(category.Name);

                this.catalog.Verify(
                    cat => cat.GetAllCoursesByCategory(category.Name),
                    Times.AtLeastOnce());
                Assert.That(actual, Is.All.InstanceOf(typeof(CourseDTO)));
            }
        }
コード例 #5
0
        public void GetCourseWithDecksDTOTest()
        {
            var sut = new CatalogBll(this.catalog.Object, this.converter.Object);

            foreach (var course in courses)
            {
                var actual = sut.GetCourseWithDecksDTO(course.Name);

                this.catalog.Verify(cat => cat.GetCourse(course.Name), Times.AtLeastOnce());
                this.converter.Verify(
                    conv => conv.ConvertToCourseWithDecksDTO(It.IsAny <Course>()),
                    Times.AtLeastOnce());
                Assert.That(actual, Is.InstanceOf(typeof(CourseWithDecksDTO)));
            }
        }