Exemplo n.º 1
0
        public void ShadeLevelUp_CorrectlyRaisesTransformEvent()
        {
            //arrange
            Shade shade         = new Shade(1, _chanceService, Shade.ExperienceForLevel[Shade.MaxShadeLevel] - 1);
            Shade absorbedShade = new Shade(1, _chanceService, 1);

            _chanceService.PushWhichEventOccurs(0); //so AbsorbShade method doesn't throw an exception

            _logger.Subscribe(EventType.FighterTransformed, shade);
            string beforeBaseName = shade.BaseName;

            //act
            shade.AbsorbShade(absorbedShade);

            //assert
            List <EventLog> logs = _logger.Logs;

            Assert.AreEqual(1, logs.Count);

            EventLog log = logs[0];

            FighterTransformedEventArgs e = log.E as FighterTransformedEventArgs;

            Assert.NotNull(e);

            Assert.AreEqual(beforeBaseName, e.PreTransformDisplayName);
            Assert.AreEqual($"a {shade.BaseName}", e.PostTransformDisplayName);
        }
Exemplo n.º 2
0
        private void LevelUp()
        {
            string baseNameBeforeLevelUp = DisplayName;

            CalcualteBaseName();

            FighterTransformedEventArgs e = new FighterTransformedEventArgs(baseNameBeforeLevelUp, $"a {BaseName}");

            OnShadeTransformed(e);
        }
Exemplo n.º 3
0
 private void _logFighterTransformed(object sender, FighterTransformedEventArgs e)
 {
     Logs.Add(new EventLog(EventType.FighterTransformed, sender, e));
 }
 protected void PrintFighterTransformedMessage(object sender, FighterTransformedEventArgs e)
 {
     _output.WriteLine($"{e.PreTransformDisplayName} has transformed to become {e.PostTransformDisplayName}!");
 }
Exemplo n.º 5
0
 public void OnShadeTransformed(FighterTransformedEventArgs e)
 {
     ShadeTransformed?.Invoke(this, e);
 }