示例#1
0
        public void DeleteBeneficiaryById_Success_Test()
        {
            // Arrange
            int id = 1;

            // create mock for repository
            var mock = new Mock <IBeneficiaryRepository>();

            mock.Setup(s => s.DeleteBeneficiary(Moq.It.IsAny <int>())).Verifiable();

            // service
            BeneficiaryService beneficiaryService = new BeneficiaryService();

            BeneficiaryService.Repository = mock.Object;

            // Act
            beneficiaryService.DeleteBeneficiary(id);

            // Assert
            Assert.IsTrue(true);
        }
示例#2
0
        public void DeleteBeneficiary_Success_Test()
        {
            // Arrange
            BeneficiaryDTO dto = SampleBeneficiaryDTO(1);

            dto.IsDeleted = false;

            // create mock for repository
            var mock = new Mock <IBeneficiaryRepository>();

            mock.Setup(s => s.DeleteBeneficiary(Moq.It.IsAny <R_Beneficiary>())).Verifiable();

            // service
            BeneficiaryService beneficiaryService = new BeneficiaryService();

            BeneficiaryService.Repository = mock.Object;

            // Act
            beneficiaryService.DeleteBeneficiary(dto);

            // Assert
            Assert.IsTrue(true);
        }