Esempio n. 1
0
        protected void OnCurrentCombatStatisticsChanged(object sender, CurrentCombatStatisticsChangedEventArgs args)
        {
            Guard.WhenArgument(args, nameof(CurrentCombatStatisticsChangedEventArgs)).IsNull().Throw();
            Guard.WhenArgument(args.CombatStatistics, nameof(ICombatStatistics)).IsNull().Throw();

            var finalizedCombatStatistics = this.combatStatisticsFinalizationStrategy.FinalizeCombatStatistics(args.CombatStatistics);
            var storedCombatStatistics    = this.combatStatisticsPersistentStorageStrategy.StoreCombatStatistics(finalizedCombatStatistics);
        }
Esempio n. 2
0
        public void CreateCorrectEventArgsInstance_WhenParametersAreValid()
        {
            // Arrange
            var combatStatistics = new Mock <ICombatStatistics>();

            // Act
            var actualInstance = new CurrentCombatStatisticsChangedEventArgs(combatStatistics.Object);

            // Assert
            Assert.That(actualInstance, Is.Not.Null);
            Assert.That(actualInstance, Is.InstanceOf <EventArgs>());
        }
Esempio n. 3
0
        public void ThrowArgumentNullException_WhenCurrentCombatStatisticsChangedEventArgsParameterIsNull()
        {
            // Arrange
            var commandResolutionHandler                  = new Mock <ICommandResolutionHandler>();
            var combatStatisticsContainer                 = new Mock <ICombatStatisticsContainer>();
            var combatStatisticsFinalizationStrategy      = new Mock <ICombatStatisticsFinalizationStrategy>();
            var combatStatisticsPersistentStorageStrategy = new Mock <ICombatStatisticsPersistentStorageStrategy>();
            var liveCombatStatisticsCreationStrategy      = new Mock <ILiveCombatStatisticsCreationStrategy>();

            var logFileParserEngine = new MockLogFileParserEngine(commandResolutionHandler.Object, combatStatisticsContainer.Object, combatStatisticsFinalizationStrategy.Object, combatStatisticsPersistentStorageStrategy.Object, liveCombatStatisticsCreationStrategy.Object);

            CurrentCombatStatisticsChangedEventArgs args = null;

            // Act & Assert
            Assert.That(
                () => logFileParserEngine.OnCurrentCombatStatisticsChanged(null, args),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(CurrentCombatStatisticsChangedEventArgs)));
        }
Esempio n. 4
0
        public void InvokeICombatStatisticsFinalizationStrategy_FinalizeCombatStatisticsOnceWithCorrectParameter()
        {
            // Arrange
            var commandResolutionHandler                  = new Mock <ICommandResolutionHandler>();
            var combatStatisticsContainer                 = new Mock <ICombatStatisticsContainer>();
            var combatStatisticsFinalizationStrategy      = new Mock <ICombatStatisticsFinalizationStrategy>();
            var combatStatisticsPersistentStorageStrategy = new Mock <ICombatStatisticsPersistentStorageStrategy>();
            var liveCombatStatisticsCreationStrategy      = new Mock <ILiveCombatStatisticsCreationStrategy>();

            var logFileParserEngine = new MockLogFileParserEngine(commandResolutionHandler.Object, combatStatisticsContainer.Object, combatStatisticsFinalizationStrategy.Object, combatStatisticsPersistentStorageStrategy.Object, liveCombatStatisticsCreationStrategy.Object);

            var combatStatistics = new Mock <ICombatStatistics>();
            var args             = new CurrentCombatStatisticsChangedEventArgs(combatStatistics.Object);

            // Act
            logFileParserEngine.OnCurrentCombatStatisticsChanged(null, args);

            // Assert
            combatStatisticsFinalizationStrategy.Verify(s => s.FinalizeCombatStatistics(args.CombatStatistics), Times.Once);
        }
Esempio n. 5
0
 internal new void OnCurrentCombatStatisticsChanged(object sender, CurrentCombatStatisticsChangedEventArgs args)
 {
     base.OnCurrentCombatStatisticsChanged(sender, args);
 }