Example #1
0
 internal void DoInit(FullDataSet <ItemDescriptor> data)
 {
     _log.Debug("using initial test data:\n{0}",
                LogValues.Defer(() =>
                                string.Join("\n", data.Data.Select(coll =>
                                                                   coll.Key.Name + ":\n" + string.Join("\n", coll.Value.Items.Select(kv =>
                                                                                                                                     coll.Key.Serialize(kv.Value)
                                                                                                                                     ))
                                                                   ))
                                ));
     _updates.Init(data);
 }
        public void DeferCallsFunctionOnlyWhenStringified()
        {
            var calls = 0;
            var thing = LogValues.Defer(() =>
            {
                calls++;
                return(String.Format("calls={0}", calls));
            });

            Assert.Equal(0, calls);
            var s1 = thing.ToString();

            Assert.Equal("calls=1", s1);
            Assert.Equal(1, calls);
            var s2 = thing.ToString();

            Assert.Equal("calls=2", s2);
        }
Example #3
0
 internal void DoUpdate(DataKind kind, string key, ItemDescriptor item)
 {
     _log.Debug("updating \"{0}\" in {1} to {2}", key, kind.Name, LogValues.Defer(() =>
                                                                                  kind.Serialize(item)));
     _updates.Upsert(kind, key, item);
 }