public void CanStoreAndFindTypeWithString() { var item = new TypeWithAString() { String = null }; var item2 = new TypeWithAString() { String = "asdf" }; var index = new Linqdex <TypeWithAString>(); index.Add(item); index.Add(item2); Assert.AreEqual(item, index.ToIndexedQuery().Where(t => t.String == null).ToArray().Single()); Assert.AreEqual(item2, index.ToIndexedQuery().Where(t => t.String == "asdf").ToArray().Single()); }
public void CanStoreAndFindTypeWithANullableDateTimeOffset() { var item = new TypeWithANullableDateTimeOffset() { Now = null }; var dateTimeOffset = DateTimeOffset.Now; var item2 = new TypeWithANullableDateTimeOffset() { Now = dateTimeOffset }; var index = new Linqdex <TypeWithANullableDateTimeOffset>(); index.Add(item); index.Add(item2); Assert.AreEqual(item, index.ToIndexedQuery().Where(t => t.Now == null).ToArray().Single()); Assert.AreEqual(item2, index.ToIndexedQuery().Where(t => t.Now == dateTimeOffset).ToArray().Single()); }
public void CanStoreAndFindTypeWithADateTimeOffset() { var item = new TypeWithADateTimeOffset() { Now = DateTimeOffset.Now }; var index = new Linqdex <TypeWithADateTimeOffset>(); index.Add(item); Assert.AreEqual(item, index.ToIndexedQuery().Where(t => t.Now > DateTimeOffset.Now.Date).ToArray().Single()); }
public void CanAddAnItemAndRetreiveIt() { var indexedList = new Linqdex <Person>(); var expected = new Person() { Name = "Arnold" }; indexedList.Add(expected); var actual = indexedList.ToIndexedQuery().Single(p => p.Name == "Arnold"); Assert.AreEqual(expected, actual); }
public void CanRemoveAnItemAndNotRetreiveIt() { var indexedList = new Linqdex <Person>(); var expected = new Person() { Name = "Arnold" }; indexedList.Add(expected); indexedList.Remove(expected); var actual = indexedList.ToIndexedQuery().SingleOrDefault(p => p.Name == "Arnold"); Assert.Null(actual); }
public void CanUpdateAnItemAndNotRetreiveIt() { var observableCollection = new Linqdex <Person>(); var expected = new Person() { Name = "Arnold" }; observableCollection.Add(expected); expected.Name = "Todd"; var actual = observableCollection.ToIndexedQuery().SingleOrDefault(p => p.Name == "Arnold"); Assert.Null(actual); }
public void CanChangeAnItemAndRetreiveIt() { var indexedList = new Linqdex <Person>(); var expected = new Person() { Name = "Arnold" }; indexedList.Add(expected); expected.Name = "Marvin"; var actual = indexedList.ToIndexedQuery().SingleOrDefault(p => p.Name == "Marvin"); Assert.NotNull(actual); }