コード例 #1
0
        public void Initialize()
        {
            // Item navigation properties
            _header = new Header()
            {
                Title  = string.Empty.PadRight(50, 'H'),
                UserId = 1
            };
            _entry = new Entry()
            {
                Message = string.Empty.PadRight(2000, 'M')
            };

            // Mock
            _mockItemRepository = new Mock <IRepository <Item> >();
            _mockUow            = new Mock <IUnitOfWork>();
            _mockUow
            .Setup(uow => uow.GetRepository <Item>())
            .Returns(_mockItemRepository.Object);
            _mockUow
            .Setup(u => u.Commit())
            .Returns(3);
            _mockItemRepository
            .Setup(r => r.Insert(It.IsAny <Item>()))
            .Returns(_item);

            // Sut
            _sut = new ItemDomainService(_mockItemRepository.Object);
        }
コード例 #2
0
        public void Initialize()
        {
            // Item navigation properties
            _header = new Header()
            {
                Title = string.Empty.PadRight(50, 'H'),
                UserId = 1
            };
            _entry = new Entry()
            {
                Message = string.Empty.PadRight(2000, 'M')
            };

            // Mock
            _mockItemRepository = new Mock<IRepository<Item>>();
            _mockUow = new Mock<IUnitOfWork>();
            _mockUow
                .Setup(uow => uow.GetRepository<Item>())
                .Returns(_mockItemRepository.Object);
            _mockUow
                .Setup(u => u.Commit())
                .Returns(3);
            _mockItemRepository
                .Setup(r => r.Insert(It.IsAny<Item>()))
                .Returns(_item);

            // Sut
            _sut = new ItemDomainService(_mockItemRepository.Object);
        }
コード例 #3
0
 public ItemHandler(IItemRepository itemRepository, ItemDomainService itemDomainService)
 {
     _itemRepository    = itemRepository;
     _itemDomainService = itemDomainService;
 }