コード例 #1
0
        public void Verify_Search_AsListing_Should_ReturnAListOfCharacterPowersWithDataMatchingSearchParametersWithListingMapping()
        {
            // Arrange
            var mockCharacterPowersRepository = CharacterPowersMockingSetup.DoMockingSetupForRepository();
            var searchModel = new Mock <ICharacterPowerSearchModel>();
            var mockCharacterPowersMapper = new Mock <ICharacterPowerMapper>();

            mockCharacterPowersMapper.Setup(m => m.AreEqual(It.IsAny <ICharacterPowerModel>(), It.IsAny <ICharacterPower>())).Returns(() => true);
            var businessWorkflow = new CharacterPowersBusinessWorkflow(mockCharacterPowersRepository.Object, mockCharacterPowersMapper.Object);

            // Act
            businessWorkflow.Search(searchModel.Object, true);
            // Assert
            mockCharacterPowersRepository.Verify(m => m.Search(It.IsAny <ICharacterPowerSearchModel>(), It.IsAny <bool>()), Times.Once);
        }
 public void Verify_Search_Should_ReturnAListOfCharacterPowers()
 {
     // Arrange
     var mockCharacterPowersRepository = CharacterPowersMockingSetup.DoMockingSetupForRepository();
     var searchModel = new Mock<ICharacterPowerSearchModel>();
     var mockCharacterPowersMapper = new Mock<ICharacterPowerMapper>();
     mockCharacterPowersMapper.Setup(m => m.AreEqual(It.IsAny<ICharacterPowerModel>(), It.IsAny<ICharacterPower>())).Returns(() => true);
     var businessWorkflow = new CharacterPowersBusinessWorkflow(mockCharacterPowersRepository.Object, mockCharacterPowersMapper.Object);
     // Act
     businessWorkflow.Search(searchModel.Object);
     // Assert
     mockCharacterPowersRepository.Verify(m => m.Search(It.IsAny<ICharacterPowerSearchModel>(), It.IsAny<bool>()), Times.Once);
 }