示例#1
0
            public void EventIdShouldDeserialize(
                string eventId
                )
            {
                var source = $@"""EventId={eventId}""";
                var result = JsonSerializer.Deserialize <CloudFormationStackEvent>(source);

                result !.EventId.Should().Be(eventId);
            }
        public void LastReturnsLogEntry()
        {
            const LogLevel logLevel  = LogLevel.Error;
            var            eventId   = Model.Create <EventId>();
            var            state     = Guid.NewGuid().ToString();
            var            data      = Guid.NewGuid().ToString();
            var            exception = new ArgumentNullException(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());

            string Formatter(string message, Exception?error) => data;

            using var sut = new CacheLogger();

            sut.Log(logLevel, eventId, state, exception, Formatter);

            sut.Last !.EventId.Should().Be(eventId);
            sut.Last.Exception.Should().Be(exception);
            sut.Last.LogLevel.Should().Be(logLevel);
            sut.Last.State.Should().Be(state);
            sut.Last.Message.Should().Be(data);
        }