Exemplo n.º 1
0
        public void VerifyNothingElse(int time)
        {
            var expectations = Expectations.Where(e => e.Time == time).Where(e => e.Marble == null).ToList();

            if (!expectations.Any())
            {
                return;
            }

            foreach (var exp in expectations)
            {
                try
                {
                    exp.Assertion();
                }
                catch (Exception e)
                {
                    throw new Exception(
                              $"At time {time}, unexpected events were received {ErrorMessageHelper.SequenceWithPointerToOffendingMoment(Sequence, time)}{Environment.NewLine}{e.Message}.", e);
                }
            }
        }
Exemplo n.º 2
0
        private void InvokeAssertions(int time, List <ExpectedMarble> expectations)
        {
            if (!expectations.Any())
            {
                return;
            }

            foreach (var exp in expectations)
            {
                try
                {
                    exp.Assertion();
                }
                catch (MissingEventException mee)
                {
                    throw new Exception(
                              $"At time {time}, for marble '{exp.Marble}' not all expected events were received {ErrorMessageHelper.SequenceWithPointerToOffendingMoment(Sequence, time)}{Environment.NewLine}{mee.Message}.",
                              mee);
                }
            }
Exemplo n.º 3
0
 private async Task Run(InputMarble m, int time)
 {
     try
     {
         await m.Action();
     }
     catch (Exception e)
     {
         throw new Exception(
                   $"At time {time}, there was an error when firing marble '{m.Marble}' {ErrorMessageHelper.SequenceWithPointerToOffendingMoment(Sequence, time)}", e);
     }
 }