public void NullTests(bool isManaged) { RealmValue rv = RealmValue.Null; if (isManaged) { var retrievedObject = PersistAndFind(rv); rv = retrievedObject.RealmValueProperty; } Assert.That(rv == RealmValue.Null); Assert.That(rv.Type, Is.EqualTo(RealmValueType.Null)); Assert.That(rv.AsNullableBool() == null); Assert.That(rv.AsNullableChar() == null); Assert.That(rv.AsNullableDate() == null); Assert.That(rv.AsNullableDecimal() == null); Assert.That(rv.AsNullableDecimal128() == null); Assert.That(rv.AsNullableDouble() == null); Assert.That(rv.AsNullableFloat() == null); Assert.That(rv.AsNullableGuid() == null); Assert.That(rv.AsNullableObjectId() == null); Assert.That(rv.AsNullableByte() == null); Assert.That(rv.AsNullableByteRealmInteger() == null); Assert.That(rv.AsNullableInt16() == null); Assert.That(rv.AsNullableInt16RealmInteger() == null); Assert.That(rv.AsNullableInt32() == null); Assert.That(rv.AsNullableInt32RealmInteger() == null); Assert.That(rv.AsNullableInt64() == null); Assert.That(rv.AsNullableInt64RealmInteger() == null); Assert.That((bool?)rv == null); Assert.That((DateTimeOffset?)rv == null); Assert.That((decimal?)rv == null); Assert.That((Decimal128?)rv == null); Assert.That((double?)rv == null); Assert.That((float?)rv == null); Assert.That((Guid?)rv == null); Assert.That((ObjectId?)rv == null); Assert.That((byte?)rv == null); Assert.That((RealmInteger <byte>?)rv == null); Assert.That((short?)rv == null); Assert.That((RealmInteger <short>?)rv == null); Assert.That((int?)rv == null); Assert.That((RealmInteger <int>?)rv == null); Assert.That((long?)rv == null); Assert.That((RealmInteger <long>?)rv == null); }
public void GuidTests(Guid value, bool isManaged) { RealmValue rv = value; if (isManaged) { var retrievedObject = PersistAndFind(rv); rv = retrievedObject.RealmValueProperty; } Assert.That(rv == value); Assert.That(rv.Type, Is.EqualTo(RealmValueType.Guid)); Assert.That((Guid)rv == value); Assert.That(rv.As <Guid>() == value); Assert.That((Guid?)rv == value); Assert.That(rv.As <Guid?>() == value); Assert.That(rv.AsGuid() == value); Assert.That(rv.AsNullableGuid() == value); Assert.That(rv != RealmValue.Null); }