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; }
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))); }