Example #1
0
        public void InterestingCase2()
        {
            var member1Key      = new NameKey("x");
            var memeber1TypeBox = new Box <IOrType <IFrontendType <IVerifiableType>, IError> >();
            var member1         = new WeakMemberDefinition(Access.ReadWrite, member1Key, memeber1TypeBox);
            var type1           = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                member1
            }));

            memeber1TypeBox.Fill(OrType.Make <IFrontendType <IVerifiableType>, IError>(type1));

            var member2Key      = new NameKey("x");
            var memeber2TypeBox = new Box <IOrType <IFrontendType <IVerifiableType>, IError> >();
            var member2         = new WeakMemberDefinition(Access.ReadWrite, member2Key, memeber2TypeBox);
            var member3Key      = new NameKey("y");
            var member3         = new WeakMemberDefinition(Access.ReadWrite, member3Key, new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(new NumberType())));
            var type2           = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                member2, member3
            }));

            memeber2TypeBox.Fill(OrType.Make <IFrontendType <IVerifiableType>, IError>(type2));

            Assert.False(type1.TheyAreUs(type2, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
            Assert.False(type2.TheyAreUs(type1, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
        }
Example #2
0
        public void TypeDontHaveVariance()
        {
            var a1 = A1();
            var a2 = A2();
            var b1 = B1();
            var b2 = B2();

            var t1 = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("a"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1))),
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("b"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)))
            }));

            var t2 = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("a"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a2))),
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("b"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b2)))
            }));


            Assert.False(t2.TheyAreUs(t1, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
            Assert.False(t1.TheyAreUs(t2, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
        }