Exemplo n.º 1
0
        public void PopulatedListMonadLaw(Law <TestArgs <ListF, string, int, long> > law)
        {
            var args = TestArgs.Default <ListF>();

            args.LiftedA = new List <string> {
                args.A
            }.K();
            args.LiftedB = new List <int> {
                args.B
            }.K();
            args.LiftedFuncAtoB = new List <Func <string, int> > {
                args.FuncAtoB
            }.K();
            args.LiftedFuncBtoC = new List <Func <int, long> > {
                args.FuncBtoC
            }.K();
            args.FuncAtoLiftedB = a => new List <int> {
                args.FuncAtoB(a)
            }.K();
            args.FuncBtoLiftedC = b => new List <long> {
                args.FuncBtoC(b)
            }.K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 2
0
        public void OkFunctorLaw(Law <TestArgs <ResultOkF <bool>, string, int, long> > law)
        {
            var args = TestArgs.Default <ResultOkF <bool> >();

            args.LiftedA = Ok(args.A).K <string, bool>();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 3
0
        public void ErrorInvariantLaw(Law <TestArgs <ResultOkF <bool>, string, int, long> > law)
        {
            var args = TestArgs.Default <ResultOkF <bool> >();

            args.LiftedA = Error(false).K <string, bool>();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 4
0
        public void SuccessFunctorLaw(Law <TestArgs <TryF, string, int, long> > law)
        {
            var args = TestArgs.Default <TryF>();

            args.LiftedA = new Success <string>(args.A);

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 5
0
        public void FailureFunctorLaw(Law <TestArgs <TryF, string, int, long> > law)
        {
            var args = TestArgs.Default <TryF>();

            args.LiftedA = GetFailure <string>().K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 6
0
        public void SomeFunctorLaw(Law <TestArgs <OptionF, string, int, long> > law)
        {
            var args = TestArgs.Default <OptionF>();

            args.LiftedA = Some(args.A);

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 7
0
        public void EmptyListFunctorLaw(Law <TestArgs <ListF, string, int, long> > law)
        {
            var args = TestArgs.Default <ListF>();

            args.LiftedA = new List <string>().K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 8
0
        public void NoneInvariantLaw(Law <TestArgs <OptionF, string, int, long> > law)
        {
            var args = TestArgs.Default <OptionF>();

            args.LiftedA = None.K <string>();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 9
0
        public void PopulatedListInvariantLaw(Law <TestArgs <ListF, string, int, long> > law)
        {
            var args = TestArgs.Default <ListF>();

            args.LiftedA = new List <string> {
                args.A
            }.K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 10
0
        public void OkApplyLaw(Law <TestArgs <ResultOkF <bool>, string, int, long> > law)
        {
            var args = TestArgs.Default <ResultOkF <bool> >();

            args.LiftedA        = Ok(args.A).K <string, bool>();
            args.LiftedB        = Ok(args.B).K <int, bool>();
            args.LiftedFuncAtoB = Ok(args.FuncAtoB).K <Func <string, int>, bool>();
            args.LiftedFuncBtoC = Ok(args.FuncBtoC).K <Func <int, long>, bool>();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 11
0
        public void ErrorApplyLaw(Law <TestArgs <ResultOkF <bool>, string, int, long> > law)
        {
            var args = TestArgs.Default <ResultOkF <bool> >();

            args.LiftedA        = Error(false).K <string, bool>();
            args.LiftedB        = Error(false).K <int, bool>();
            args.LiftedFuncAtoB = Error(false).K <Func <string, int>, bool>();
            args.LiftedFuncBtoC = Error(false).K <Func <int, long>, bool>();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 12
0
        public void SuccessApplicativeLaw(Law <TestArgs <TryF, string, int, long> > law)
        {
            var args = TestArgs.Default <TryF>();

            args.LiftedA        = new Success <string>(args.A);
            args.LiftedB        = new Success <int>(args.B);
            args.LiftedFuncAtoB = new Success <Func <string, int> >(args.FuncAtoB);
            args.LiftedFuncBtoC = new Success <Func <int, long> >(args.FuncBtoC);

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 13
0
        public void EmptyListApplyLaw(Law <TestArgs <ListF, string, int, long> > law)
        {
            var args = TestArgs.Default <ListF>();

            args.LiftedA        = new List <string>().K();
            args.LiftedB        = new List <int>().K();
            args.LiftedFuncAtoB = new List <Func <string, int> >().K();
            args.LiftedFuncBtoC = new List <Func <int, long> >().K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 14
0
        public void SomeApplyLaw(Law <TestArgs <OptionF, string, int, long> > law)
        {
            var args = TestArgs.Default <OptionF>();

            args.LiftedA        = Some(args.A);
            args.LiftedB        = Some(args.B);
            args.LiftedFuncAtoB = Some(args.FuncAtoB);
            args.LiftedFuncBtoC = Some(args.FuncBtoC);

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 15
0
        public void NoneApplyLaw(Law <TestArgs <OptionF, string, int, long> > law)
        {
            var args = TestArgs.Default <OptionF>();

            args.LiftedA        = None.K <string>();
            args.LiftedB        = None.K <int>();
            args.LiftedFuncAtoB = None.K <Func <string, int> >();
            args.LiftedFuncBtoC = None.K <Func <int, long> >();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 16
0
        public void FailureApplyLaw(Law <TestArgs <TryF, string, int, long> > law)
        {
            var args = TestArgs.Default <TryF>();

            args.LiftedA        = GetFailure <string>().K();
            args.LiftedB        = GetFailure <int>().K();
            args.LiftedFuncAtoB = GetFailure <Func <string, int> >().K();
            args.LiftedFuncBtoC = GetFailure <Func <int, long> >().K();

            law.TestLaw(args).ShouldBe(true);
        }
Exemplo n.º 17
0
        public void SuccessMonadLaw(Law <TestArgs <TryF, string, int, long> > law)
        {
            var args = TestArgs.Default <TryF>();

            args.LiftedA        = new Success <string>(args.A);
            args.LiftedB        = new Success <int>(args.B);
            args.LiftedFuncAtoB = new Success <Func <string, int> >(args.FuncAtoB);
            args.LiftedFuncBtoC = new Success <Func <int, long> >(args.FuncBtoC);
            args.FuncAtoLiftedB = a => new Success <int>(args.FuncAtoB(a));
            args.FuncBtoLiftedC = b => new Success <long>(args.FuncBtoC(b));

            law.TestLaw(args).ShouldBe(true);
        }