コード例 #1
0
        public void EqualsWithSameObject()
        {
            var configuration = new Mock <IConfiguration>();
            {
                configuration.Setup(c => c.HasValueFor(It.IsAny <ConfigurationKey>()))
                .Returns(false);
            }

            var template = new DebugLogTemplate(configuration.Object, GetDefaultDateTime);

            Assert.IsTrue(template.Equals((object)template));
        }
コード例 #2
0
        public void Translate()
        {
            var configuration = new Mock <IConfiguration>();
            {
                configuration.Setup(c => c.HasValueFor(It.IsAny <ConfigurationKey>()))
                .Returns(false);
            }

            var template = new DebugLogTemplate(configuration.Object, GetDefaultDateTime);
            var msg      = new LogMessage(LevelToLog.Info, "blabla");
            var text     = template.Translate(msg);

            var expectedText = string.Format(
                CultureInfo.CurrentCulture,
                DebugLogTemplate.DebugLogFormat,
                GetDefaultDateTime().ToString("yyyy/MM/ddTHH:mm:ss.fffff zzz", CultureInfo.CurrentCulture),
                msg.Level,
                msg.Text());

            Assert.AreEqual(expectedText, text);
        }