public async Task UpdateNoChange()
        {
            // Setup the first and second request.
            var f = new FileInfo("1020448.json");

            AutoWebAccess.AddUriResponse("http://inspirehep.net:80/record/1020448?ln=en&of=recjson", f);

            int count = 0;

            using (var cs = new InSpireContactStore())
            {
                // Watch for updates. Since no change, we should see only one.
                cs.ContactUpdateStream.Subscribe(u =>
                {
                    count++;
                });

                // Add.
                var c = GetInspireSimpleContact(f) as InSpireContact;
                cs.Add(c);

                // Trigger the update.
                await cs.Update();
            }
            Assert.AreEqual(1, count);
        }
        public async Task UpdateLastName()
        {
            // Setup the first and second request.
            var f = new FileInfo("1020448.json");

            AutoWebAccess.AddUriResponse("http://inspirehep.net:80/record/1020448?ln=en&of=recjson", f);

            int count   = 0;
            int updates = 0;

            using (var cs = new InSpireContactStore())
            {
                // Watch for updates. Since no change, we should see only one.
                cs.ContactUpdateStream.Subscribe(u =>
                {
                    count++;
                    if (u._reason == ContactTrackerLib.Database.ContactDB.UpdateReason.Update)
                    {
                        Assert.AreEqual("Last Name", u._updateReasonText);
                        updates++;
                    }
                });

                // Add.
                var c = GetInspireSimpleContact(f) as InSpireContact;
                c.LastName = "Mable";
                cs.Add(c);

                // Trigger the update.
                await cs.Update();
            }
            Assert.AreEqual(2, count);
            Assert.AreEqual(1, updates);
        }
        public void InspireNewItemBeforeAttached()
        {
            int count = 0;

            using (var cs = new InSpireContactStore())
            {
                cs.Add(GetInspireSimpleContact());

                // Check that we have a single contact.
                cs.ContactUpdateStream.Subscribe(u => count++);
            }
            Assert.AreEqual(1, count);
        }