コード例 #1
0
        public async Task ExportToXml()
        {
            // given
            List <Page> actualPages = _fixture.CreateMany <Page>().ToList();

            _pageRepositoryMock.AllPagesAsync()
            .Returns(actualPages);

            XmlSerializer serializer = new XmlSerializer(typeof(List <Page>));

            // when
            string actualXml = await _exportController.ExportPagesToXml();

            // then
            var deserializedPages = serializer.Deserialize(new StringReader(actualXml)) as List <Page>;

            deserializedPages.Count.ShouldBe(actualPages.Count());
        }