Exemplo n.º 1
0
        public void GetOneAuditTypeReturnsNullTest()
        {
            //Arrange
            var mockAuditTypeRepository = new Mock <IAuditTypeRepository>();
            var mockMapper = new Mock <IMapper>();

            mockAuditTypeRepository.Setup(e => e.Get(It.IsAny <int>())).Returns <AuditType>(null);
            mockMapper.Setup(e => e.Map <AuditType, AuditTypeOutput>(It.IsAny <AuditType>())).Returns <AuditTypeOutput>(null);

            var useCase = new GetOneAuditTypeUseCase(mockAuditTypeRepository.Object, mockMapper.Object);

            //Act
            var res = useCase.Execute(1);

            //Assert
            Assert.Null(res);
        }
Exemplo n.º 2
0
        public void GetOneAuditTypeReturnsSuccessfullyTest()
        {
            //Arrange
            AuditType       at  = new AuditType("Codigo", "Nombre", true, 1);
            AuditTypeOutput atO = new AuditTypeOutput()
            {
                Id = 1, Code = "Codigo", Name = "Nombre", Active = true
            };

            var mockAuditTypeRepository = new Mock <IAuditTypeRepository>();
            var mockMapper = new Mock <IMapper>();

            mockAuditTypeRepository.Setup(e => e.Get(It.IsAny <int>())).Returns(at);
            mockMapper.Setup(e => e.Map <AuditType, AuditTypeOutput>(It.IsAny <AuditType>())).Returns(atO);

            var useCase = new GetOneAuditTypeUseCase(mockAuditTypeRepository.Object, mockMapper.Object);

            //Act
            var res = useCase.Execute(1);

            //Assert
            Assert.IsType <AuditTypeOutput>(res);
        }