public void SetUp() { _user1 = new UserFixture { Name = "John", DateOfBirth = new DateTime(1980, 01, 23) }; _user2 = new UserFixture { Name = "John", DateOfBirth = new DateTime(1980, 01, 23) }; MongoCollection.Insert(new CachedItem(_user1.Id.ToString(), _user1, DateTime.Now.AddHours(1))); MongoCollection.Insert(new CachedItem(_user2.Id.ToString(), _user2, DateTime.Now.AddHours(1))); }
public void SetUp() { _user = new UserFixture { Name = "John", DateOfBirth = new DateTime(1980, 01, 23) }; MongoCollection.Insert(new CachedItem(_user.Id.ToString(), _user, DateTime.Now.AddHours(1))); }
public void SetUp() { MongoCollection.RemoveAll(); _user = new UserFixture { Name = "John", DateOfBirth = new DateTime(1980, 01, 23) }; }
public void adding_item_with_duplicate_key_updates_original() { MongoDbApiOutputCache.Add("user", _user, DateTime.Now.AddSeconds(60)); var differentUser = new UserFixture { Name = "Simon" }; MongoDbApiOutputCache.Add("user", differentUser, DateTime.Now.AddSeconds(60)); Assert.That(MongoCollection.Count(), Is.EqualTo(1)); var item = JsonSerializer.DeserializeFromString<UserFixture>(MongoCollection.FindOneAs<CachedItem>().Value); Assert.That(item, Is.Not.Null); Assert.That(item.Id, Is.EqualTo(differentUser.Id)); Assert.That(item.Name, Is.EqualTo(differentUser.Name)); }
public void adding_item_with_duplicate_key_updates_original() { MongoDbApiOutputCache.Add("user", _user, DateTime.Now.AddSeconds(60)); var differentUser = new UserFixture { Name = "Simon" }; MongoDbApiOutputCache.Add("user", differentUser, DateTime.Now.AddSeconds(60)); Assert.That(MongoCollection.Count(), Is.EqualTo(1)); var item = JsonSerializer.DeserializeFromString <UserFixture>(MongoCollection.FindOneAs <CachedItem>().Value); Assert.That(item, Is.Not.Null); Assert.That(item.Id, Is.EqualTo(differentUser.Id)); Assert.That(item.Name, Is.EqualTo(differentUser.Name)); }
public void SetUp() { _user = new UserFixture { Name = "John", DateOfBirth = new DateTime(1980, 01, 23) }; MongoCollection.Insert(new CachedItem(_user.Id.ToString(), _user, DateTime.Now.AddSeconds(60))); }