Example #1
0
        public void Any()
        {
            var a1 = A1();
            var a2 = A2();
            var b1 = B1();
            var b2 = B2();
            var m1 = new MethodType(new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a2)), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)));
            var m2 = new MethodType(new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(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)))
            }));
            var or1 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );
            var or2 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );

            var any = new AnyType();

            Assert.All(new[] { a1, a2, b1, b2, m1, m2, t1, t2, or1, or2 }, x => any.TheyAreUs(x, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()));
        }