public void ProfiledCommandToSpanUsesCommandAsDbStatementAttribute()
        {
            var profiledCommand = new Mock <IProfiledCommand>();

            profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
            profiledCommand.Setup(m => m.Command).Returns("SET");
            var result = ((SpanSdk)RedisProfilerEntryToSpanConverter.ProfilerCommandToSpan(this.tracer, null, profiledCommand.Object));

            Assert.Contains(result.Attributes, kvp => kvp.Key == "db.statement");
            Assert.Equal("SET", result.Attributes.GetValue("db.statement"));
        }
        public void DrainSessionUsesCommandAsName()
        {
            var profiledCommand = new Mock <IProfiledCommand>();

            profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
            profiledCommand.Setup(m => m.Command).Returns("SET");

            var result = (SpanSdk)RedisProfilerEntryToSpanConverter.ProfilerCommandToSpan(tracer, null, profiledCommand.Object);

            Assert.Equal("SET", result.Name);
        }
        public void ProfiledCommandToSpanUsesFlagsForFlagsAttribute()
        {
            var profiledCommand = new Mock <IProfiledCommand>();

            profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
            var expectedFlags = StackExchange.Redis.CommandFlags.FireAndForget |
                                StackExchange.Redis.CommandFlags.NoRedirect;

            profiledCommand.Setup(m => m.Flags).Returns(expectedFlags);
            var result = ((SpanSdk)RedisProfilerEntryToSpanConverter.ProfilerCommandToSpan(this.tracer, null, profiledCommand.Object));

            Assert.Contains(result.Attributes, kvp => kvp.Key == "redis.flags");
            Assert.Equal("None, FireAndForget, NoRedirect", result.Attributes.GetValue("redis.flags"));
        }