public void GetValue_FromUnAssignedNullableGuidProperty_ReturnsNull()
        {
            var item = new GuidDummy();
            var property = TypeInfo<GuidDummy>.GetIdProperty("NullableId");

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue<GuidDummy, Guid>(item);

            Assert.IsNull(idViaAccessor);
        }
        public void GetValue_FromUnAssignedNullableIdentityProperty_ReturnsAssignedInt()
        {
            var item = new IdentityDummy();
            var property = TypeInfo<IdentityDummy>.GetIdProperty("NullableId");

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue<IdentityDummy, int>(item);

            Assert.IsNull(idViaAccessor);
        }
示例#3
0
        public void GetValue_FromUnAssignedNullableGuidProperty_ReturnsNull()
        {
            var item     = new NullableGuidDummy();
            var property = StructurePropertyTestFactory.GetIdProperty <NullableGuidDummy>();

            var idAccessor    = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.IsTrue(idViaAccessor.IsEmpty);
        }
        public void GetValue_FromAssignedNullableIdentityProperty_ReturnsAssignedInt()
        {
            const int id = 42;
            var item = new IdentityDummy { NullableId = id };
            var property = TypeInfo<IdentityDummy>.GetIdProperty("NullableId");

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue<IdentityDummy, int>(item);

            Assert.AreEqual(id, idViaAccessor);
        }
        public void GetValue_FromAssignedNullableGuidProperty_ReturnsAssignedGuid()
        {
            var id = Guid.Parse("fc47a673-5a5b-419b-9a40-a756591aa7bf");
            var item = new GuidDummy { NullableId = id };
            var property = TypeInfo<GuidDummy>.GetIdProperty("NullableId");

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue<GuidDummy, Guid>(item);

            Assert.AreEqual(id, idViaAccessor);
        }
        public void GetValue_FromAssignedNullableGuidProperty_ReturnsAssignedGuid()
        {
            var id = Guid.Parse("fc47a673-5a5b-419b-9a40-a756591aa7bf");
            var item = new NullableGuidDummy { StructureId = id };
            var property = StructurePropertyTestFactory.GetIdProperty<NullableGuidDummy>();

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
        public void GetValue_FromAssignedStringProperty_ReturnsAssignedString()
        {
            var id = "My string id.";
            var item = new StringDummy { StructureId = id };
            var property = StructurePropertyTestFactory.GetIdProperty<StringDummy>();

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
        public void GetValue_FromAssignedLongIdentityProperty_ReturnsAssignedValue()
        {
            var id = 42;
            var item = new BigIdentityDummy { StructureId = id };
            var property = StructurePropertyTestFactory.GetIdProperty<BigIdentityDummy>();

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
示例#9
0
        public void GetValue_FromAssignedNullableGuidProperty_ReturnsAssignedGuid()
        {
            var id   = Guid.Parse("fc47a673-5a5b-419b-9a40-a756591aa7bf");
            var item = new NullableGuidDummy {
                StructureId = id
            };
            var property = StructurePropertyTestFactory.GetIdProperty <NullableGuidDummy>();

            var idAccessor    = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
示例#10
0
        public void GetValue_FromAssignedStringProperty_ReturnsAssignedString()
        {
            var id   = "My string id.";
            var item = new StringDummy {
                StructureId = id
            };
            var property = StructurePropertyTestFactory.GetIdProperty <StringDummy>();

            var idAccessor    = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
示例#11
0
        public void GetValue_FromAssignedNullableLongIdentityProperty_ReturnsAssignedValue()
        {
            var id   = 42;
            var item = new NullableBigIdentityDummy {
                StructureId = id
            };
            var property = StructurePropertyTestFactory.GetIdProperty <NullableBigIdentityDummy>();

            var idAccessor    = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.AreEqual(id, idViaAccessor.Value);
        }
        public void GetValue_FromUnAssignedNullableGuidProperty_ReturnsNull()
        {
            var item = new NullableGuidDummy();
            var property = StructurePropertyTestFactory.GetIdProperty<NullableGuidDummy>();

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.IsTrue(idViaAccessor.IsEmpty);
        }
示例#13
0
        public void GetValue_FromUnAssignedNullableLongIdentityProperty_ReturnsNull()
        {
            var item = new NullableBigIdentityDummy();
            var property = StructurePropertyTestFactory.GetIdProperty<NullableBigIdentityDummy>();

            var idAccessor = new IdAccessor(property);
            var idViaAccessor = idAccessor.GetValue(item);

            Assert.IsFalse(idViaAccessor.HasValue);
        }