예제 #1
0
        public void SetUp()
        {
            var mockLogger = new Mock <ILogger>();

            mockLogger.Setup(s => s.Logar(It.IsAny <string>(), It.IsAny <TipoLog>()));

            _domainService = new Mock <ITorreHanoiDomainService>();
            _domainService.Setup(s => s.Criar(It.IsAny <int>())).Returns(Guid.NewGuid);
            _domainService.Setup(s => s.ObterPor(It.IsAny <Guid>())).Returns(() => new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object));
            _domainService.Setup(s => s.ObterTodos()).Returns(() => new List <global::Domain.TorreHanoi.TorreHanoi> {
                new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object)
            });

            _appService = new TorreHanoiApplicationService(_domainService.Object, mockLogger.Object, new DesignerService());
        }
        public void SetUp()
        {
            var mockLogger = new Mock <ILogger>();

            mockLogger.Setup(s => s.Logar(It.IsAny <string>(), It.IsAny <TipoLog>()));

            var mockDesignerService = new Mock <IDesignerService>();

            mockDesignerService.Setup(s => s.Desenhar()).Returns(() => new global::System.Drawing.Bitmap(10, 10));

            var mockTorreHanoiDomainService = new Mock <ITorreHanoiDomainService>();

            mockTorreHanoiDomainService.Setup(s => s.Criar(It.IsAny <int>())).Returns(Guid.NewGuid);
            mockTorreHanoiDomainService.Setup(s => s.ObterPor(It.IsAny <Guid>())).Returns(() => new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object));
            mockTorreHanoiDomainService.Setup(s => s.ObterTodos()).Returns(() => new List <global::Domain.TorreHanoi.TorreHanoi> {
                new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object)
            });

            _service = new TorreHanoiApplicationService(mockTorreHanoiDomainService.Object, mockLogger.Object, mockDesignerService.Object);
        }
        public void SetUp()
        {
            var mockLogger = new Mock <ILogger>();

            mockLogger.Setup(s => s.Logar(It.IsAny <string>(), It.IsAny <TipoLog>()));

            var mockDesignerService = new Mock <IDesignerService>();

            mockDesignerService.Setup(x => x.Inicializar(new TorreHanoiAdapter().DomainParaDesignerDto(new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object))));
            mockDesignerService.Setup(x => x.Desenhar()).Returns(() => new Bitmap($"{Directory.GetCurrentDirectory()}\\Application\\torreHanoiImagem.bmp"));

            var mockTorreHanoiDomainService = new Mock <ITorreHanoiDomainService>();

            mockTorreHanoiDomainService.Setup(s => s.Criar(It.IsAny <int>())).Returns(Guid.NewGuid);
            mockTorreHanoiDomainService.Setup(s => s.ObterPor(It.IsAny <Guid>())).Returns(() => new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object));
            mockTorreHanoiDomainService.Setup(s => s.ObterTodos()).Returns(() => new List <global::Domain.TorreHanoi.TorreHanoi> {
                new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object)
            });

            _service = new TorreHanoiApplicationService(mockTorreHanoiDomainService.Object, mockLogger.Object, mockDesignerService.Object);
        }
 public TorreHanoiController(ITorreHanoiApplicationService service)
 {
     _service = service;
 }