コード例 #1
0
        public async Task GetPresentation_ShouldReturnPresentation()
        {
            // Arrange
            var queuePresentationAddedMock = new Mock <PresentationAddedQueue>();
            var queueScheduleAddedMock     = new Mock <PresentationScheduleAddedQueue>();
            var presentationRepositoryMock = new Mock <IPresentationRepository>();

            presentationRepositoryMock.Setup(presentationRepository =>
                                             presentationRepository.GetPresentationAsync(It.IsAny <int>()))
            .ReturnsAsync((int id) => new Presentation
            {
                PresentationId = id,
                Abstract       = "Abstract",
                Title          = "Title",
                PowerpointUri  = "PowerpointUri",
            });

            var presentationManager = new PresentationManager(presentationRepositoryMock.Object,
                                                              queuePresentationAddedMock.Object, queueScheduleAddedMock.Object);
            var presentationId = 15; // any Random Number will do

            // Act
            var presentation = await presentationManager.GetPresentationAsync(presentationId);

            // Assert
            Assert.NotNull(presentation);
            Assert.Equal(presentationId, presentation.PresentationId);
            Assert.Equal("Abstract", presentation.Abstract);
            Assert.Equal("Title", presentation.Title);
            Assert.Equal("PowerpointUri", presentation.PowerpointUri);
        }