コード例 #1
0
        public CombatStatisticsPersistentStorageStrategy(IStoredCombatStatisticsDataProvider storedCombatStatisticsDataProvider, IEntityFrameworkTransactionFactory entityFrameworkTransactionFactory, IObjectMapperProvider objectMapperProvider)
        {
            Guard.WhenArgument(storedCombatStatisticsDataProvider, nameof(IStoredCombatStatisticsDataProvider)).IsNull().Throw();
            Guard.WhenArgument(entityFrameworkTransactionFactory, nameof(IEntityFrameworkTransactionFactory)).IsNull().Throw();
            Guard.WhenArgument(objectMapperProvider, nameof(IObjectMapperProvider)).IsNull().Throw();

            this.storedCombatStatisticsDataProvider = storedCombatStatisticsDataProvider;
            this.entityFrameworkTransactionFactory  = entityFrameworkTransactionFactory;
            this.objectMapperProvider = objectMapperProvider;
        }
コード例 #2
0
ファイル: Constructor_Should.cs プロジェクト: shakuu/Parser
        public void ThrowArgumentNullException_WhenIStoredCombatStatisticsDataProviderParameterIsNull()
        {
            // Arrange
            IStoredCombatStatisticsDataProvider storedCombatStatisticsDataProvider = null;
            var businessTransactionFactory = new Mock <IEntityFrameworkTransactionFactory>();
            var objectMapperProvider       = new Mock <IObjectMapperProvider>();

            // Act & Assert
            Assert.That(
                () => new CombatStatisticsPersistentStorageStrategy(storedCombatStatisticsDataProvider, businessTransactionFactory.Object, objectMapperProvider.Object),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(IStoredCombatStatisticsDataProvider)));
        }