Beispiel #1
0
        public void GetHandle_ThrowsOnUnsupportedCast()
        {
            var id = new ObjectID(_orderClassDefinition, new Guid("{5D09030C-25C2-4735-B514-46333BD28AC8}"));

            Assert.That(
                () => id.GetHandle <OrderItem>(),
                Throws.TypeOf <ArgumentException>().With.Message.EqualTo(
                    "The ObjectID 'Order|5d09030c-25c2-4735-b514-46333bd28ac8|System.Guid' cannot be represented as an "
                    + "'IDomainObjectHandle<Remotion.Data.DomainObjects.UnitTests.TestDomain.OrderItem>'.\r\nParameter name: T"));
        }
Beispiel #2
0
        public void GetHandle_BaseClass()
        {
            var id = new ObjectID(_orderClassDefinition, new Guid("{5D09030C-25C2-4735-B514-46333BD28AC8}"));

            var result = id.GetHandle <DomainObject>();

            Assert.That(result, Is.TypeOf <DomainObjectHandle <Order> > ());
            Assert.That(result.ObjectID, Is.EqualTo(id));
            Assert.That(VariableTypeInferrer.GetVariableType(result), Is.SameAs(typeof(IDomainObjectHandle <DomainObject>)));
        }