コード例 #1
0
        public void Initialization()
        {
            _mockLogger        = new Mock <ILogger>();
            _mockCardGroupRepo = new Mock <ICardGroupsRepository>();
            _mockGroupFacade   = new Mock <IGroupFacade>();

            _mockCardGroupRepo
            .Setup(a => a.GetListOfCards())
            .Returns(_expectedList);
            _mockCardGroupRepo
            .Setup(a => a.DeleteGroupOfCard(1))
            .Returns(true);
            _mockCardGroupRepo
            .Setup(a => a.GetAdditionalCards(1))
            .Returns(_expectedList);
            _mockCardGroupRepo
            .Setup(a => a.AddGroup(1, 1))
            .Returns(true);
            _mockGroupFacade
            .Setup(a => a.GetGroup(1))
            .Returns(new CardGroup());


            _service = new CardGoupsService(_mockCardGroupRepo.Object, _mockGroupFacade.Object, _mockLogger.Object);
        }
コード例 #2
0
 /// <summary>
 /// Controller constructor
 /// </summary>
 /// <param name="service"></param>
 /// <param name="logger"></param>
 public CardGroupsController(ICardGroupsService service, ILogger logger)
 {
     _logger  = logger;
     _service = service ?? throw new ArgumentNullException(nameof(service));
 }