Esempio n. 1
0
        public void Error_reporting_from_C_Sharp_with_reflected_binders()
        {
            var rfq = new Rfq
            {
                FeesPerLot  = 1.0M,
                Underlyings = new[] {
                    new Underlying {
                        BaseSize      = 100M,
                        WeightedDelta = 0.11M,
                        Legs          = new [] {
                            new Leg {
                                Size = SolverValue.ProvidedNoConflict(100M), Delta = 0.4M
                            },
                            new Leg {
                                Size = SolverValue.ProvidedNoConflict(100M), Delta = -0.3M
                            }
                        }
                    }
                }
            };

            var settings = new CSharpTestsRules.Settings(true);
            var rules    = CSharpTestsRules.GetRules(settings);

            var problem       = BoundProblem.Create(rules, rfq);
            var incoherencies = problem.Solve();

            Assert.AreEqual(4, incoherencies.Length);
        }
Esempio n. 2
0
        public void Using_the_solver_from_C_Sharp_with_reflected_binders()
        {
            var rfq = new Rfq
            {
                FeesPerLot  = 1.0M,
                Underlyings = new[] {
                    new Underlying {
                        BaseSize = 100M,
                        Legs     = new [] {
                            new Leg {
                                Size = 100M, Delta = 0.4M
                            },
                            new Leg {
                                Size = 100M, Delta = -0.3M
                            }
                        }
                    }
                }
            };

            var settings = new CSharpTestsRules.Settings(true);
            var rules    = CSharpTestsRules.GetRules(settings);

            var problem       = BoundProblem.Create(rules, rfq);
            var incoherencies = problem.Solve();

            Assert.IsEmpty(incoherencies);

            Assert.IsNull(rfq.SomePropertyWithoutSetter);
            Assert.AreEqual(200M, rfq.TotalExecFees);

            var underlying = rfq.Underlyings.First();

            Assert.AreEqual(200M, underlying.ExecFees);
            Assert.AreEqual(0.1M, underlying.WeightedDelta);
        }