public void ReturnIFinalizedCombatStatisticsInstance_WithCorrectData(string expectedCharacterName, double expectedDamageDone, double expectedDamageTaken, string enterCombatTime, string exitCombatTime, double expectedDamageDonePerSecond, double expectedDamageTakenPerSecond, double expectedCombatDurationInSeconds) { // Arrange var finalizedCombatStatisticsFactory = new Mock <IFinalizedCombatStatisticsFactory>(); var finalizedCombatStatistics = new FinalizedCombatStatistics(); finalizedCombatStatisticsFactory.Setup(f => f.CreateFinalizedCombatStatistics()).Returns(finalizedCombatStatistics); var combatStatisticsFinalizationStrategy = new CombatStatisticsFinalizationStrategy(finalizedCombatStatisticsFactory.Object); var combatStatistics = new Mock <ICombatStatistics>(); combatStatistics.SetupGet(s => s.CharacterName).Returns(expectedCharacterName); combatStatistics.SetupGet(s => s.DamageDone).Returns(expectedDamageDone); combatStatistics.SetupGet(s => s.DamageTaken).Returns(expectedDamageTaken); combatStatistics.SetupGet(s => s.EnterCombatTime).Returns(DateTime.Parse(enterCombatTime)); combatStatistics.SetupGet(s => s.ExitCombatTime).Returns(DateTime.Parse(exitCombatTime)); var actualFinalizedCommand = combatStatisticsFinalizationStrategy.FinalizeCombatStatistics(combatStatistics.Object); // Assert Assert.That(actualFinalizedCommand.CharacterName, Is.EqualTo(expectedCharacterName)); Assert.That(actualFinalizedCommand.DamageDone, Is.EqualTo(expectedDamageDone)); Assert.That(actualFinalizedCommand.DamageTaken, Is.EqualTo(expectedDamageTaken)); Assert.That(actualFinalizedCommand.DamageDonePerSecond, Is.EqualTo(expectedDamageDonePerSecond)); Assert.That(actualFinalizedCommand.DamageTakenPerSecond, Is.EqualTo(expectedDamageTakenPerSecond)); Assert.That(actualFinalizedCommand.CombatDurationInSeconds, Is.EqualTo(expectedCombatDurationInSeconds)); }
public void CreateCorrectICombatStatisticsFinalizationStrategyInstance_WhenParametersAreValid() { // Arrange var finalizedCombatStatisticsFactory = new Mock <IFinalizedCombatStatisticsFactory>(); // Act var actualInstance = new CombatStatisticsFinalizationStrategy(finalizedCombatStatisticsFactory.Object); // Assert Assert.That(actualInstance, Is.Not.Null); Assert.That(actualInstance, Is.InstanceOf <ICombatStatisticsFinalizationStrategy>()); }
public void ThrowArgumentNullException_WhenICombatStatisticsParameterIsNull() { // Arrange var finalizedCombatStatisticsFactory = new Mock <IFinalizedCombatStatisticsFactory>(); var combatStatisticsFinalizationStrategy = new CombatStatisticsFinalizationStrategy(finalizedCombatStatisticsFactory.Object); ICombatStatistics combatStatistics = null; // Act & Assert Assert.That( () => combatStatisticsFinalizationStrategy.FinalizeCombatStatistics(combatStatistics), Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(ICombatStatistics))); }