Inheritance: JointActionResult
 private void repairOperationsView_InitNewRow(object sender, InitNewRowEventArgs e)
 {
     GridView view = sender as GridView;
     if(view.IsValidRowHandle(e.RowHandle))
     {
         currentJointWeldResult = view.GetRow(e.RowHandle) as JointWeldResult;
         currentJointWeldResult.IsActive = true;
         currentJointWeldResult.Joint = viewModel.Joint;
         viewModel.Joint.JointWeldResults.Add(currentJointWeldResult);
     }
 }
        public void TestJointNewEdit()
        {
            var modifiableView = new Mock<IModifiable>();
            var notify = new Mock<IUserNotify>();
            var repoJoint = new Mock<IJointRepository>();
            var repoJointTestResult = new Mock<IJointTestResultRepository>();
            var repoJointWeldResult = new Mock<IJointWeldResultRepository>();
            var repoJointOperation =  new Mock< IJointOperationRepository>();
            var repoInspector = new Mock<IInspectorRepository>();
            var repoWelder = new Mock<IWelderRepository>();
            var repoAdo = new Mock<IMillReportsRepository>();
            var securityCtx = new Mock<ISecurityContext>();
            var repoSpool = new Mock<ISpoolRepository>();
            var repoPipe = new Mock<IPipeRepository>();
            var repoComponent = new Mock<IComponentRepository>();

            var joint = new Prizm.Domain.Entity.Construction.Joint() { Status = Domain.Entity.Construction.JointStatus.Withdrawn};
            BindingList<JointOperation> operations = new BindingList<JointOperation>(); 

            Mock<IConstructionRepository> repoConstruction = new Mock<IConstructionRepository>();
            repoConstruction.SetupGet(_ => _.RepoJoint).Returns(repoJoint.Object);
            repoConstruction.SetupGet(_ => _.RepoJointTestResult).Returns(repoJointTestResult.Object);
            repoConstruction.SetupGet(_ => _.RepoJointWeldResult).Returns(repoJointWeldResult.Object);
            repoConstruction.SetupGet(_ => _.RepoJointOperation).Returns(repoJointOperation.Object);
            repoConstruction.SetupGet(_ => _.RepoInspector).Returns(repoInspector.Object);
            repoConstruction.SetupGet(_ => _.RepoWelder).Returns(repoWelder.Object);
            repoConstruction.SetupGet(_ => _.RepoSpool).Returns(repoSpool.Object);
            repoConstruction.SetupGet(_ => _.RepoPipe).Returns(repoPipe.Object);
            repoConstruction.SetupGet(_ => _.RepoComponent).Returns(repoComponent.Object);
            repoJointOperation.Setup(_ => _.GetControlOperations()).Returns(operations);
            repoJointOperation.Setup(_ => _.GetRepairOperations()).Returns(operations);
            repoJoint.Setup(_ => _.GetActiveByNumber(joint)).Returns(new List<Prizm.Domain.Entity.Construction.Joint>());
            repoSpool.Setup(_ => _.Get(It.IsAny<Guid>())).Returns(new Domain.Entity.Construction.Spool());
            repoAdo.Setup(x => x.GetPipelineElements()).Returns(new System.Data.DataTable());

            modifiableView.SetupGet(x => x.IsModified).Returns(false);

            var viewModel = new JointNewEditViewModel(repoConstruction.Object, notify.Object, Guid.Empty, repoAdo.Object, securityCtx.Object);
            viewModel.Joint = joint;
            viewModel.FirstElement = new PartData();
            viewModel.SecondElement = new PartData();
            viewModel.ModifiableView = modifiableView.Object;
            var validatable = new Mock<IValidatable>();
            validatable.Setup(x => x.Validate()).Returns(true);
            viewModel.ValidatableView = validatable.Object;
            viewModel.Joint.LoweringDate = DateTime.Now;
            viewModel.Joint.Number = string.Empty;

            var welder = new Welder();
            var weldResult = new JointWeldResult();
            weldResult.Welders.Add(welder);
            weldResult.IsCompleted = true;

            viewModel.JointWeldResults.Add(weldResult);


            var command = new SaveJointCommand(repoConstruction.Object,viewModel, notify.Object, securityCtx.Object);
            command.Execute();
            repoConstruction.Verify(_ => _.BeginTransaction(), Times.Once());
            repoJoint.Verify(_ => _.SaveOrUpdate(It.IsAny<Prizm.Domain.Entity.Construction.Joint>()), Times.Once());
            repoConstruction.Verify(_ => _.Commit(), Times.Once());
            repoJoint.Verify(_ => _.Evict(It.IsAny<Prizm.Domain.Entity.Construction.Joint>()), Times.Once());
        }