コード例 #1
0
        public async Task GetPortfolioAndProperties_With_Invalid_PortfolioId_Returns_Correct_PortfolioAndProperties()
        {
            // Arrange
            using var dbContext = new ApplicationDbContext(_options);
            var portfolioService = new PortfolioService(dbContext, _logger.Object);

            // Act
            var result = await portfolioService.GetPortfolioAndProperties(Guid.NewGuid());

            // Assert
            Assert.IsNull(result);
        }
コード例 #2
0
        public async Task GetPortfolioAndProperties_With_Valid_PortfolioId_Returns_Correct_PortfolioAndProperties()
        {
            // Arrange
            using var dbContext = new ApplicationDbContext(_options);
            var portfolioService = new PortfolioService(dbContext, _logger.Object);

            // Act
            var result = await portfolioService.GetPortfolioAndProperties(portfolio1Id);

            // Assert
            Assert.AreEqual("Test 1", result.Name);
            Assert.AreEqual(1, result.Properties.Count());
        }