Exemplo n.º 1
0
        public static void Dependency(string expected, string username)
        {
            // Arrange

            // Act
            var result = HistoryLogKeyHelper.Dependency(username);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 2
0
        public static void Specification_DateRange(string expected, string from, string to)
        {
            // Arrange
            var spec = new HistoryLogSpecification()
            {
                DateRange = new Range <DateTime>(DateTime.Parse(from, CultureInfo.InvariantCulture), DateTime.Parse(to, CultureInfo.InvariantCulture))
            };

            // Act
            var result = HistoryLogKeyHelper.Specification(spec);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 3
0
        public static void Specification_Events(string expected, string events)
        {
            // Arrange
            var spec = new HistoryLogSpecification()
            {
                DateRange = new Range <DateTime>(new DateTime(2011, 02, 13), new DateTime(2011, 02, 14)),
                Events    = events.Split(';').Translate(s => Int16.Parse(s, CultureInfo.InvariantCulture)).ToArray()
            };

            // Act
            var result = HistoryLogKeyHelper.Specification(spec);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 4
0
        public static void Specification_EventId(string expected, int eventid)
        {
            // Arrange
            var spec = new HistoryLogSpecification()
            {
                DateRange = new Range <DateTime>(new DateTime(2011, 02, 13), new DateTime(2011, 02, 14)),
                EventId   = (short)eventid
            };

            // Act
            var result = HistoryLogKeyHelper.Specification(spec);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 5
0
        public static void Specification_Username(string expected, string username)
        {
            // Arrange
            var spec = new HistoryLogSpecification()
            {
                Username  = username,
                DateRange = new Range <DateTime>(new DateTime(2011, 02, 13), new DateTime(2011, 02, 14))
            };

            // Act
            var result = HistoryLogKeyHelper.Specification(spec);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 6
0
        private LinkedCacheDependency HistoryDependency(string username)
        {
            var key = string.Concat(Keyspace, HistoryLogKeyHelper.Dependency(username));

            return(new LinkedCacheDependency(m_cache, key, DateTime.Now.Add(HistoryLifetime)));
        }
Exemplo n.º 7
0
        public override IDictionary <short, HistoryLogEvent> MapEvents(string languageCode)
        {
            var key = string.Concat(Keyspace, HistoryLogKeyHelper.MapEvents(languageCode));

            return(DefaultCache.Instance.Get(key, () => base.MapEvents(languageCode), EventsLifetime));
        }
Exemplo n.º 8
0
        public override IEnumerable <HistoryLogEvent> ListEvents(string languageCode)
        {
            var key = string.Concat(Keyspace, HistoryLogKeyHelper.ListEvents(languageCode));

            return(DefaultCache.Instance.Get(key, () => base.ListEvents(languageCode), EventsLifetime));
        }