Exemplo n.º 1
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)));
        }
Exemplo n.º 2
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);
        }