Example #1
0
        public void DetectsAttributes()
        {
            _tracker.Configure <FooAtt>();

            //save some data
            var testData1 = new FooAtt()
            {
                Double = 123.45, Int = 456, Timespan = new TimeSpan(99, 99, 99)
            };

            _tracker.Track(testData1);
            testData1.Double = 888;
            testData1.FireRequest();
            testData1.FireStop();
            testData1.Double = 777;
            testData1.FireRequest();


            // simulate application restart and read the saved data
            _tracker = new Tracker(_store);
            var testData2 = new FooAtt()
            {
                Int = 456
            };

            _tracker.Configure <FooAtt>();
            _tracker.Track(testData2);

            Assert.Equal(888, testData2.Double);
            Assert.Equal(testData1.Int, testData2.Int);
            Assert.Equal(testData2.Timespan, new TimeSpan(99, 99, 99));
        }
Example #2
0
        public void DetectsDefaultValueAttribute()
        {
            //save some data
            var testData1 = new FooAtt();

            _tracker.Configure <FooAtt>().Track(testData1);
            Assert.Equal(3, testData1.DoubleWithDefaultValueOf3);
        }