public void WillLoadTheSameDateThatWeStored()
        {
            using (var session = store.OpenSession())
            {
                var person = new Person
                {
                    Id = "person/1",
                    FirstName = "Nabil",
                    LastName = "Shuhaiber",
                    Age = 31,
                    Title = "Vice President"
                };

                session.Store(person);
                session.SaveChanges();

                TestCreatedDate(session.Advanced.GetMetadataFor(person));
            }

            using (var session = store.OpenSession())
            {
                var person = session.Load<Person>("person/1");
                TestCreatedDate(session.Advanced.GetMetadataFor(person));
            }
        }
		public void WillNotCorruptData()
		{
			using ( new RavenDbServer(new RavenConfiguration
			{
				Port = port, 
				DataDirectory = path, 
				AnonymousUserAccessMode = AnonymousUserAccessMode.All,
				Catalog =
					{
						Catalogs = {new TypeCatalog(typeof(AuditTrigger))}
					}
			}))
			using (var store = new DocumentStore {Url = "http://localhost:8079"})
			{
				store.Initialize();

				using (IDocumentSession session = store.OpenSession())
				{
					session.Advanced.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1085");

					var person = new Person
					{
						Id = "person/1",
						FirstName = "Nabil",
						LastName = "Shuhaiber",
						Age = 31,
						Title = "Vice President"
					};

					session.Store(person);
					session.SaveChanges();

					Assert.Equal(new DateTime(2011, 02, 19, 15, 00, 00), session.Advanced.GetMetadataFor(person).Value<DateTime>("CreatedDate"));
				}

				using (IDocumentSession session = store.OpenSession())
				{
					session.Advanced.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1081");

					var person = session.Load<Person>("person/1");
					person.Age = 25;
					session.SaveChanges();

					Assert.Equal(new DateTime(2011, 02, 19, 15, 00, 00), session.Advanced.GetMetadataFor(person).Value<DateTime>("CreatedDate"));
				}

				using (IDocumentSession session = store.OpenSession())
				{
					session.Advanced.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1022");

					var person = session.Load<Person>("person/1");

					person.FirstName = "Steve";
					person.LastName = "Richmond";
					session.SaveChanges();

					Assert.Equal(new DateTime(2011, 02, 19, 15, 00, 00), session.Advanced.GetMetadataFor(person).Value<DateTime>("CreatedDate"));
				}
			}
		}
        public void WillNotCorruptData()
        {
            using (var session = store.OpenSession())
            {
                store.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1085");

                var person = new Person
                {
                    Id = "person/1",
                    FirstName = "Nabil",
                    LastName = "Shuhaiber",
                    Age = 31,
                    Title = "Vice President"
                };

                session.Store(person);
                session.SaveChanges();

                TestCreatedDate(session.Advanced.GetMetadataFor(person));
            }

            using (var session = store.OpenSession())
            {
                store.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1081");

                var person = session.Load<Person>("person/1");
                person.Age = 25;
                session.SaveChanges();

                TestCreatedDate(session.Advanced.GetMetadataFor(person));
            }

            using (var session = store.OpenSession())
            {
                store.DatabaseCommands.OperationsHeaders.Add("CurrentUserPersonId", "1022");

                var person = session.Load<Person>("person/1");

                person.FirstName = "Steve";
                person.LastName = "Richmond";
                session.SaveChanges();

                TestCreatedDate(session.Advanced.GetMetadataFor(person));
            }
        }