コード例 #1
0
        public async Task get_all_async_should_invoke_get_all_async_on_repository()
        {
            // Arrange
            var scanPageService = new ScanPageService(_scanPageRepositoryMock.Object, _mapperMock.Object);

            // Act
            await scanPageService.GetAllAsync();

            // Assert
            _scanPageRepositoryMock.Verify(x => x.GetAllAsync(), Times.Once);
        }
コード例 #2
0
        public async Task add_async_should_invoke_add_async_on_repository()
        {
            // Arrange
            var         scanPageService = new ScanPageService(_scanPageRepositoryMock.Object, _mapperMock.Object);
            ScanPageDto page            = new ScanPageDto()
            {
                UrlAddress =
                    "https://www.gumtree.pl/s-mieszkania-i-domy-sprzedam-i-kupie/warszawa/page-2/v1c9073l3200008p2",
                Active  = true,
                Host    = "Gumtree",
                HostUrl = "https://www.gumtree.pl"
            };

            // Act
            await scanPageService.AddAsync(page);

            // Assert
            _scanPageRepositoryMock.Verify(x => x.AddAsync(It.IsAny <ScanPage>()), Times.Once);
        }