Beispiel #1
0
        public override void Setup()
        {
            base.Setup();

            // Spin up mock repository and attach to controller
            MockService = new Mock<IUnderlyingFundNAVService>();

            DefaultUnderlyingFundNAV = new DeepBlue.Models.Entity.UnderlyingFundNAV(MockService.Object);
            MockService.Setup(x => x.SaveUnderlyingFundNAV(It.IsAny<DeepBlue.Models.Entity.UnderlyingFundNAV>()));
        }
 public void SaveUnderlyingFundNAV(UnderlyingFundNAV underlyingFundNAV)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (underlyingFundNAV.UnderlyingFundNAVID == 0) {
             context.UnderlyingFundNAVs.AddObject(underlyingFundNAV);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("UnderlyingFundNAVs", underlyingFundNAV);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, underlyingFundNAV);
             }
         }
         context.SaveChanges();
     }
 }
Beispiel #3
0
 private IEnumerable<ErrorInfo> Validate(UnderlyingFundNAV underlyingFundNAV)
 {
     return ValidationHelper.Validate(underlyingFundNAV);
 }