示例#1
0
        public void GetPublishedFaqsForTargetGroup_returns_expected_faqs_from_data_service()
        {
            // Given
            const int expectedTargetGroup = 3;
            var       expectedFaqs        = Builder <Faq> .CreateListOfSize(5).All().With(f => f.Published = true)
                                            .And(f => f.TargetGroup = 3).Build();

            A.CallTo(() => faqDataService.GetPublishedFaqsForTargetGroup(expectedTargetGroup))
            .Returns(expectedFaqs);

            // When
            var result = faqsService.GetPublishedFaqsForTargetGroup(expectedTargetGroup).ToList();

            // Then
            using (new AssertionScope())
            {
                result.Should().HaveCount(5);
                result.Should().BeEquivalentTo(expectedFaqs);

                A.CallTo(() => faqDataService.GetPublishedFaqsForTargetGroup(expectedTargetGroup))
                .MustHaveHappenedOnceExactly();
            }
        }
示例#2
0
 public IEnumerable <Faq> GetPublishedFaqsForTargetGroup(int targetGroup)
 {
     return(faqsDataService.GetPublishedFaqsForTargetGroup(targetGroup));
 }