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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }