Пример #1
0
 public void TestAddCurveWithPointIdNotAssociatedWithMarketId()
 {
     ICurveService service = ServiceFactory.GetCurveService();
     Curve curve = new Curve();
     curve.TenantId = 1;
     curve.MarketId = 1;
     curve.PointId = 2;
     curve.Name = "Test Curve";
     curve = service.SaveOrUpdate(curve);
 }
Пример #2
0
 public void TestAddCurveWithInvalidPointId()
 {
     ICurveService service = ServiceFactory.GetCurveService();
     Curve curve = new Curve();
     curve.TenantId = 1;
     curve.MarketId = 1;
     curve.PointId = 1111111;
     curve.Name = "Test Curve";
     curve = service.SaveOrUpdate(curve);
 }
Пример #3
0
 public void TestAddCurve()
 {
     ICurveService service = ServiceFactory.GetCurveService();
     Curve curve = new Curve();
     curve.TenantId = 1;
     curve.MarketId = 1;
     curve.Name = "Test Curve";
     curve = service.SaveOrUpdate(curve);
     Assert.IsNotNull(curve);
     Assert.IsTrue(curve.CurveId >= 1);
     Assert.IsTrue(curve.Name == "Test Curve");
 }
Пример #4
0
 public Curve SaveOrUpdate(Curve curve)
 {
     if (curve.GetId() > 0)
     {
         curve = dbContext.Curves.Attach(curve);
         dbContext.Entry(curve).State = EntityState.Modified;
     } else
     {
         curve = dbContext.Curves.Add(curve);
     }
     dbContext.SaveChanges();
     return curve;
 }