Exemplo n.º 1
0
        public async Task ShouldLogInfoWhenExecutingACommand()
        {
            var args = new FakeCommandArgs();
            await _bus.ExecuteAsync(args);

            Assert.True(args.DidExecute);
            Assert.Equal(2, _logger.GetMessages(LogLevel.Information).Length);
        }
Exemplo n.º 2
0
        public async Task ShouldUseRetryAndLoggingQueryDecorators()
        {
            var args = new FakeRetryQueryArgs(2, new int[0]);
            await _bus.ExecuteAsync <FakeRetryQueryArgs, int[]>(args);

            Assert.Equal(3, args.TimesExecuted);
            Assert.Equal(4, _logger.GetMessages(LogLevel.Information).Length);
        }
        private void DoResolveTest(string executable, string filter, int expectedLocations, int expectedErrorMessages, bool disposeResolver = true)
        {
            var locations  = new List <SourceFileLocation>();
            var fakeLogger = new FakeLogger(() => false);

            IDiaResolver resolver = DefaultDiaResolverFactory.Instance.Create(executable, "", fakeLogger);

            locations.AddRange(resolver.GetFunctions(filter));

            if (disposeResolver)
            {
                resolver.Dispose();
            }

            locations.Count.Should().Be(expectedLocations);
            fakeLogger.GetMessages(Severity.Warning, Severity.Error).Count.Should().Be(expectedErrorMessages);
        }
        private void DoResolveTest(string executable, string filter, int expectedLocations, int expectedErrorMessages, bool disposeResolver = true)
        {
            var locations  = new List <SourceFileLocation>();
            var fakeLogger = new FakeLogger(() => OutputMode.Info);

            string       pdb      = PdbLocator.FindPdbFile(executable, "", fakeLogger);
            IDiaResolver resolver = DefaultDiaResolverFactory.Instance.Create(executable, pdb, fakeLogger);

            locations.AddRange(resolver.GetFunctions(filter));

            if (disposeResolver)
            {
                resolver.Dispose();
            }

            locations.Should().HaveCountGreaterOrEqualTo(expectedLocations);
            fakeLogger.GetMessages(Severity.Warning, Severity.Error).Should().HaveCountGreaterOrEqualTo(expectedErrorMessages);
        }