コード例 #1
0
        public async Task UpdateAsync_UnknownIdPassed_ThrowExceptionIsNotNull()
        {
            // Arrange
            int familyId      = 11;
            var updatedFamily = new Family("Name")
            {
                Id = familyId
            };

            _repositoryMock
            .Setup(rep => rep.GetByIdAsync(familyId))
            .ReturnsAsync(TestData.GetFamilyById(familyId));

            // Act
            var exception = await Assert.ThrowsAsync <Exception>(() => _familyService.UpdateAsync(familyId, updatedFamily));

            // Assert
            Assert.NotNull(exception);
        }