public void MultiStageData_SetOneStage()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/layers active.wflx");
                string sSavedfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Saved layers active.wflx");

                WFInt.OpenFile(sfile);

                int initialCount = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                Assert.AreEqual(initialCount, 0);

                MultiFractureData firstStage = new MultiFractureData();

                firstStage.StageLength = 300;
                firstStage.TopMD = 10000;

                FractureData firstFracture = new FractureData();
                firstFracture.AddRef();

                firstFracture.bUseFracFaceSkin = true;
                firstFracture.bUseCalcdFracDmgSkin = true;
                firstFracture.bUseFracChokedSkin = true;
                firstFracture.bUseCalcdFracChokedSkin = true;
                firstFracture.bUseCalcdSkin = true;
                firstFracture.FracSkin = 0.5;
                firstFracture.FracHalfSpacing = 200;
                firstFracture.FracWidth = 5;
                firstFracture.FracHalfLength = 250;
                firstFracture.FracHeight = 2;
                firstFracture.FracPermNearWB = 0.2;
                firstFracture.FracWidthNearWB = 0.25;
                firstFracture.FracPerm = 0.5;
                firstFracture.FracDmgPerm = 0.74;
                firstFracture.FracDmgThick = 52;
                firstFracture.FracDmgSkinCalcd = 0.6;
                firstFracture.FracDmgSkinMeas = 75;
                firstFracture.FracChokedHalfLength = 300;
                firstFracture.FracChokedSkinCalcd = 0.65;
                firstFracture.FracChokedSkinMeas = 95;
                firstFracture.DarcySkinCalcd = 0.7;
                firstFracture.DarcySkinManual = 0.15;

                firstStage.AddRef().AddFractureData(firstFracture);

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().AddMultiFractureData(firstStage);

                firstStage.StageLength = 400;
                firstStage.TopMD = 12345;

                firstFracture.FracSkin = 1.8;
                firstFracture.FracHalfSpacing = 100;

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().SetMultiFractureData(0, firstStage, 0, firstFracture);

                WFInt.SaveFile(sSavedfile);

                WFloInterface WFIntSaved = new WFloInterface();
                WFIntSaved.AddRef();

                WFIntSaved.OpenFile(sSavedfile);

                int afterAddingCount = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                //  int afterAddingCount = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().;

                Assert.AreEqual(afterAddingCount, 1);

                #region read the number of fractures from the WellTech
                MultiFractureData savedMultiFracture = new MultiFractureData();
                savedMultiFracture.AddRef();

                FractureData savedFirstFracture = new FractureData();
                savedFirstFracture.AddRef();

                WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 0, savedFirstFracture);

                double Stagelength_1 = savedMultiFracture.StageLength;
                double TopMD_1 = savedMultiFracture.TopMD;

                int CountFractures = savedMultiFracture.NumberOfFractures;

                Assert.AreEqual(CountFractures, 1);

                Assert.AreEqual(400, savedMultiFracture.StageLength, DeltaFraction.Default(400));
                Assert.AreEqual(12345, savedMultiFracture.TopMD, DeltaFraction.Default(12345));
                #endregion

                # region get firstfracture properties

                Assert.AreEqual(1.8, savedFirstFracture.FracSkin, DeltaFraction.Default(1.8));       // Value has been changed.
                Assert.AreEqual(100, savedFirstFracture.FracHalfSpacing, DeltaFraction.Default(100)); // Value has been changed.
                Assert.AreEqual(5, savedFirstFracture.FracWidth, DeltaFraction.Default(5));
                Assert.AreEqual(250, savedFirstFracture.FracHalfLength, DeltaFraction.Default(250));
                Assert.AreEqual(2, savedFirstFracture.FracHeight, DeltaFraction.Default(2));
                Assert.AreEqual(0.2, savedFirstFracture.FracPermNearWB, DeltaFraction.Default(0.2));
                Assert.AreEqual(0.25, savedFirstFracture.FracWidthNearWB, DeltaFraction.Default(0.25));
                Assert.AreEqual(0.5, savedFirstFracture.FracPerm, DeltaFraction.Default(0.5));
                Assert.AreEqual(0.74, savedFirstFracture.FracDmgPerm, DeltaFraction.Default(0.74));
                Assert.AreEqual(52, savedFirstFracture.FracDmgThick, DeltaFraction.Default(52));
                Assert.AreEqual(0.6, savedFirstFracture.FracDmgSkinCalcd, DeltaFraction.Default(0.6));
                Assert.AreEqual(75, savedFirstFracture.FracDmgSkinMeas, DeltaFraction.Default(75));
                Assert.AreEqual(300, savedFirstFracture.FracChokedHalfLength, DeltaFraction.Default(300));

                Assert.AreEqual(0.65, savedFirstFracture.FracChokedSkinCalcd, DeltaFraction.Default(0.65));
                Assert.AreEqual(95, savedFirstFracture.FracChokedSkinMeas, DeltaFraction.Default(95));

                Assert.AreEqual(0.7, savedFirstFracture.DarcySkinCalcd, DeltaFraction.Default(0.7));
                Assert.AreEqual(0.15, savedFirstFracture.DarcySkinManual, DeltaFraction.Default(0.15));
                #endregion

            }
        }
        public void MultiStageData_RemoveOneStage()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/layers active.wflx");
                string sSavedfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Saved layers active.wflx");

                WFInt.OpenFile(sfile);

                int initialCount = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                Assert.AreEqual(initialCount, 0);

                MultiFractureData firstStage = new MultiFractureData();

                firstStage.StageLength = 300;
                firstStage.TopMD = 10000;

                FractureData firstFracture = new FractureData();
                firstFracture.AddRef();

                firstFracture.bUseFracFaceSkin = true;
                firstFracture.bUseCalcdFracDmgSkin = true;
                firstFracture.bUseFracChokedSkin = true;
                firstFracture.bUseCalcdFracChokedSkin = true;
                firstFracture.bUseCalcdSkin = true;
                firstFracture.FracSkin = 0.5;
                firstFracture.FracHalfSpacing = 200;
                firstFracture.FracWidth = 5;
                firstFracture.FracHalfLength = 250;
                firstFracture.FracHeight = 2;
                firstFracture.FracPermNearWB = 0.2;
                firstFracture.FracWidthNearWB = 0.25;
                firstFracture.FracPerm = 0.5;
                firstFracture.FracDmgPerm = 0.74;
                firstFracture.FracDmgThick = 52;
                firstFracture.FracDmgSkinCalcd = 0.6;
                firstFracture.FracDmgSkinMeas = 75;
                firstFracture.FracChokedHalfLength = 300;
                firstFracture.FracChokedSkinCalcd = 0.65;
                firstFracture.FracChokedSkinMeas = 95;
                firstFracture.DarcySkinCalcd = 0.7;
                firstFracture.DarcySkinManual = 0.15;

                firstStage.AddRef().AddFractureData(firstFracture);

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().AddMultiFractureData(firstStage);

                int afterAddingCount = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                //  int afterAddingCount = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().;

                Assert.AreEqual(afterAddingCount, 1);

                #region read the number of fractures from the WellTech
                MultiFractureData savedMultiFracture = new MultiFractureData();
                savedMultiFracture.AddRef();

                FractureData savedFirstFracture = new FractureData();
                savedFirstFracture.AddRef();

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 0, savedFirstFracture);

                double Stagelength_1 = savedMultiFracture.StageLength;
                double TopMD_1 = savedMultiFracture.TopMD;

                int CountFractures = savedMultiFracture.NumberOfFractures;

                Assert.AreEqual(CountFractures, 1);

                Assert.AreEqual(300, savedMultiFracture.StageLength, DeltaFraction.Default(300));
                Assert.AreEqual(10000, savedMultiFracture.TopMD, DeltaFraction.Default(10000));

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().RemoveAllOneStageData();

                int afterRemoveAll = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                Assert.AreEqual(afterRemoveAll, 0);

                #endregion
            }
        }
        public void MultiStageData_GetOneStage()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/layers active.wflx");
                string sSavedfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Saved layers active.wflx");

                WFInt.OpenFile(sfile);

                int initialCount = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                Assert.AreEqual(initialCount, 0);

                MultiFractureData firstStage = new MultiFractureData();

                firstStage.StageLength = 300;
                firstStage.TopMD = 10000;

                FractureData firstFracture = new FractureData();
                firstFracture.AddRef();

                firstFracture.bUseFracFaceSkin = true;
                firstFracture.bUseCalcdFracDmgSkin = true;
                firstFracture.bUseFracChokedSkin = true;
                firstFracture.bUseCalcdFracChokedSkin = true;
                firstFracture.bUseCalcdSkin = true;
                firstFracture.FracSkin = 0.5;
                firstFracture.FracHalfSpacing = 200;
                firstFracture.FracWidth = 5;
                firstFracture.FracHalfLength = 250;
                firstFracture.FracHeight = 2;
                firstFracture.FracPermNearWB = 0.2;
                firstFracture.FracWidthNearWB = 0.25;
                firstFracture.FracPerm = 0.5;
                firstFracture.FracDmgPerm = 0.74;
                firstFracture.FracDmgThick = 52;
                firstFracture.FracDmgSkinCalcd = 0.6;
                firstFracture.FracDmgSkinMeas = 75;
                firstFracture.FracChokedHalfLength = 300;
                firstFracture.FracChokedSkinCalcd = 0.65;
                firstFracture.FracChokedSkinMeas = 95;
                firstFracture.DarcySkinCalcd = 0.7;
                firstFracture.DarcySkinManual = 0.15;

                firstStage.AddRef().AddFractureData(firstFracture);

                FractureData secondFracture = new FractureData();
                secondFracture.AddRef();

                secondFracture.bUseFracFaceSkin = true;
                secondFracture.bUseCalcdFracDmgSkin = true;
                secondFracture.bUseFracChokedSkin = true;
                secondFracture.bUseCalcdFracChokedSkin = true;
                secondFracture.bUseCalcdSkin = true;
                secondFracture.FracSkin = 0.345;
                secondFracture.FracHalfSpacing = 234;
                secondFracture.FracWidth = 0.5;
                secondFracture.FracHalfLength = 350;
                secondFracture.FracHeight = 2;
                secondFracture.FracPermNearWB = 0.2;
                secondFracture.FracWidthNearWB = 0.25;
                secondFracture.FracPerm = 0.5;
                secondFracture.FracDmgPerm = 0.74;
                secondFracture.FracDmgThick = 52;
                secondFracture.FracDmgSkinCalcd = 0.6;
                secondFracture.FracDmgSkinMeas = 75;
                secondFracture.FracChokedHalfLength = 300;
                secondFracture.FracChokedSkinCalcd = 0.65;
                secondFracture.FracChokedSkinMeas = 95;
                secondFracture.DarcySkinCalcd = 0.7;
                secondFracture.DarcySkinManual = 0.15;

                firstStage.AddRef().AddFractureData(secondFracture);

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().AddMultiFractureData(firstStage);

                WFInt.SaveFile(sSavedfile);

                WFloInterface WFIntSaved = new WFloInterface();
                WFIntSaved.AddRef();

                WFIntSaved.OpenFile(sSavedfile);

                int afterAddingCount = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;

                //  int afterAddingCount = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().;

                Assert.AreEqual(afterAddingCount, 1);

                #region read the number of fractures from the WellTech
                MultiFractureData savedMultiFracture = new MultiFractureData();
                savedMultiFracture.AddRef();

                FractureData savedFirstFracture = new FractureData();
                savedFirstFracture.AddRef();

                WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 0, savedFirstFracture);

                double Stagelength_1 = savedMultiFracture.StageLength;
                double TopMD_1 = savedMultiFracture.TopMD;

                int CountFractures = savedMultiFracture.NumberOfFractures;

                Assert.AreEqual(CountFractures, 2);

                Assert.AreEqual(300, savedMultiFracture.StageLength, DeltaFraction.Default(300));
                Assert.AreEqual(10000, savedMultiFracture.TopMD, DeltaFraction.Default(0.5));
                #endregion

                # region get firstfracture properties

                Assert.AreEqual(0.5, savedFirstFracture.FracSkin, DeltaFraction.Default(0.5));
                Assert.AreEqual(200, savedFirstFracture.FracHalfSpacing, DeltaFraction.Default(200));
                Assert.AreEqual(5, savedFirstFracture.FracWidth, DeltaFraction.Default(5));
                Assert.AreEqual(250, savedFirstFracture.FracHalfLength, DeltaFraction.Default(250));
                Assert.AreEqual(2, savedFirstFracture.FracHeight, DeltaFraction.Default(2));
                Assert.AreEqual(0.2, savedFirstFracture.FracPermNearWB, DeltaFraction.Default(0.2));
                Assert.AreEqual(0.25, savedFirstFracture.FracWidthNearWB, DeltaFraction.Default(0.25));
                Assert.AreEqual(0.5, savedFirstFracture.FracPerm, DeltaFraction.Default(0.5));
                Assert.AreEqual(0.74, savedFirstFracture.FracDmgPerm, DeltaFraction.Default(0.74));
                Assert.AreEqual(52, savedFirstFracture.FracDmgThick, DeltaFraction.Default(52));
                Assert.AreEqual(0.6, savedFirstFracture.FracDmgSkinCalcd, DeltaFraction.Default(0.6));
                Assert.AreEqual(75, savedFirstFracture.FracDmgSkinMeas, DeltaFraction.Default(75));
                Assert.AreEqual(300, savedFirstFracture.FracChokedHalfLength, DeltaFraction.Default(300));

                Assert.AreEqual(0.65, savedFirstFracture.FracChokedSkinCalcd, DeltaFraction.Default(0.65));
                Assert.AreEqual(95, savedFirstFracture.FracChokedSkinMeas, DeltaFraction.Default(95));

                Assert.AreEqual(0.7, savedFirstFracture.DarcySkinCalcd, DeltaFraction.Default(0.7));
                Assert.AreEqual(0.15, savedFirstFracture.DarcySkinManual, DeltaFraction.Default(0.15));

                #endregion

                #region get secondfracture properties
                WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 1, savedFirstFracture);

                // WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture);

                // Fractures are added to the stage before writing to the WellTech. Both stage and fracture properties will be gotten from the WellTech when calling the GetMultiFractureData,
                // then fracture properties will be read based on the Stage class. Thus, no GetFractureData method is used here.

                Assert.AreEqual(0.345, savedFirstFracture.FracSkin, DeltaFraction.Default(0.345));
                Assert.AreEqual(234, savedFirstFracture.FracHalfSpacing, DeltaFraction.Default(234));
                Assert.AreEqual(0.5, savedFirstFracture.FracWidth, DeltaFraction.Default(0.5));
                Assert.AreEqual(350, savedFirstFracture.FracHalfLength, DeltaFraction.Default(350));
                Assert.AreEqual(2, savedFirstFracture.FracHeight, DeltaFraction.Default(2));
                Assert.AreEqual(0.2, savedFirstFracture.FracPermNearWB, DeltaFraction.Default(0.2));
                Assert.AreEqual(0.25, savedFirstFracture.FracWidthNearWB, DeltaFraction.Default(0.25));
                Assert.AreEqual(0.5, savedFirstFracture.FracPerm, DeltaFraction.Default(0.5));
                Assert.AreEqual(0.74, savedFirstFracture.FracDmgPerm, DeltaFraction.Default(0.74));
                Assert.AreEqual(52, savedFirstFracture.FracDmgThick, DeltaFraction.Default(52));
                Assert.AreEqual(0.6, savedFirstFracture.FracDmgSkinCalcd, DeltaFraction.Default(0.6));
                Assert.AreEqual(75, savedFirstFracture.FracDmgSkinMeas, DeltaFraction.Default(75));
                Assert.AreEqual(300, savedFirstFracture.FracChokedHalfLength, DeltaFraction.Default(300));

                Assert.AreEqual(0.65, savedFirstFracture.FracChokedSkinCalcd, DeltaFraction.Default(0.65));
                Assert.AreEqual(95, savedFirstFracture.FracChokedSkinMeas, DeltaFraction.Default(95));

                Assert.AreEqual(0.7, savedFirstFracture.DarcySkinCalcd, DeltaFraction.Default(0.7));
                Assert.AreEqual(0.15, savedFirstFracture.DarcySkinManual, DeltaFraction.Default(0.15));
                #endregion
            }
        }
        public void MultiStageData_MultiFractureProductivities()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Multiple Fractures.wflx");
                string sSavedfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Saved Multiple Fractures.wflx");

                //open wellflo
                WFInt.OpenFile(sfile);

                int initialCount = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().NumberOfFractureStages;
                bool bMatrix = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().UseReservoirMatrixCorrection;

                double ReservoirPI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().ReservoirProductivityIndex;
                double FracturePI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().FractureProductivityIndex;
                double WellborePI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().WellboreProductivityIndex;
                double MatrixPI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().MatrixProductivityIndex;

                double PI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().ProductivityIndex;

                ReservoirPI = Math.Round(ReservoirPI, 4);
                FracturePI = Math.Round(FracturePI, 4);
                WellborePI = Math.Round(WellborePI, 4);
                MatrixPI = Math.Round(MatrixPI, 1);
                PI = Math.Round(PI, 4);

                Assert.AreEqual(ReservoirPI, 1.0072, DeltaFraction.Default(ReservoirPI));
                Assert.AreEqual(FracturePI, 0.4215, DeltaFraction.Default(FracturePI));
                Assert.AreEqual(WellborePI, 0.0354, DeltaFraction.Default(WellborePI));
                Assert.AreEqual(MatrixPI, 0.0, DeltaFraction.Default(MatrixPI));
                Assert.AreEqual(PI, 0.0317, DeltaFraction.Default(PI));

                // Get the first stage first fracture pro
                MultiFractureData savedMultiFracture = new MultiFractureData();
                savedMultiFracture.AddRef();
                FractureData savedFirstFracture = new FractureData();
                savedFirstFracture.AddRef();
                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 0, savedFirstFracture);

                double Stagelength_1 = savedMultiFracture.StageLength;
                double TopMD_1 = savedMultiFracture.TopMD;
                int CountFractures = savedMultiFracture.NumberOfFractures;

                Assert.AreEqual(CountFractures, 1);
                Assert.AreEqual(313, Stagelength_1, DeltaFraction.Default(313));
                Assert.AreEqual(5000, TopMD_1, DeltaFraction.Default(5000));

                // Use the Reservoir Matrix Correction
                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().UseReservoirMatrixCorrection = true; //true
                bool bMatrix_1 = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().UseReservoirMatrixCorrection;
                //save wellflo
                WFInt.SaveFile(sSavedfile);

                WFloInterface WFIntSaved = new WFloInterface();
                WFIntSaved.AddRef();
                //open the saved wellflo
                WFIntSaved.OpenFile(sSavedfile);

                bool savedbMatrix = WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().UseReservoirMatrixCorrection;
                Assert.AreEqual(savedbMatrix, true);

                double NewReservoirPI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().ReservoirProductivityIndex;
                double NewFracturePI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().FractureProductivityIndex;
                double NewWellborePI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().WellboreProductivityIndex;
                double NewMatrixPI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().MatrixProductivityIndex;

                double NewPI = WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().ProductivityIndex;

                NewReservoirPI = Math.Round(NewReservoirPI, 4);
                NewFracturePI = Math.Round(NewFracturePI, 4);
                NewWellborePI = Math.Round(NewWellborePI, 4);
                NewMatrixPI = Math.Round(NewMatrixPI, 4);
                NewPI = Math.Round(NewPI, 4);

                Assert.AreEqual(NewReservoirPI, 1.0072, DeltaFraction.Default(NewReservoirPI));
                Assert.AreEqual(NewFracturePI, 0.4215, DeltaFraction.Default(NewFracturePI));
                Assert.AreEqual(NewWellborePI, 0.0354, DeltaFraction.Default(NewWellborePI));
                Assert.AreEqual(NewMatrixPI, 0.0122, DeltaFraction.Default(NewMatrixPI));
                Assert.AreEqual(NewPI, 0.0439, DeltaFraction.Default(NewPI));

            }
        }
        public void MultiStageData_ChokedModel()
        {
            using (new LifeTimeScope())
            {
                WFloInterface WFInt = new WFloInterface();
                WFInt.AddRef();

                string sfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/layers active.wflx");
                string sSavedfile = WellFloFileLocation.BaselineWPSModel("WPS_Layer/Saved layers active.wflx");

                WFInt.OpenFile(sfile);

                MultiFractureData firstStage = new MultiFractureData();

                firstStage.StageLength = 300;
                firstStage.TopMD = 10000;
                firstStage.ChokedModel = 1;

                FractureData firstFracture = new FractureData();
                firstFracture.AddRef();

                firstFracture.bUseFracFaceSkin = true;
                firstFracture.bUseCalcdFracDmgSkin = true;
                firstFracture.bUseFracChokedSkin = true;
                firstFracture.bUseCalcdFracChokedSkin = true;
                firstFracture.bUseCalcdSkin = true;
                firstFracture.FracSkin = 0.5;
                firstFracture.FracHalfSpacing = 200;
                firstFracture.FracWidth = 5;
                firstFracture.FracHalfLength = 250;
                firstFracture.FracHeight = 2;
                firstFracture.FracPermNearWB = 0.2;
                firstFracture.FracWidthNearWB = 0.25;
                firstFracture.FracPerm = 0.5;
                firstFracture.FracDmgPerm = 0.74;
                firstFracture.FracDmgThick = 52;
                firstFracture.FracDmgSkinCalcd = 0.6;
                firstFracture.FracDmgSkinMeas = 75;
                firstFracture.FracChokedHalfLength = 300;
                firstFracture.FracChokedSkinCalcd = 0.65;
                firstFracture.FracChokedSkinMeas = 95;
                firstFracture.DarcySkinCalcd = 0.7;
                firstFracture.DarcySkinManual = 0.15;

                firstStage.AddRef().AddFractureData(firstFracture);

                WFInt.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().AddMultiFractureData(firstStage);

                WFInt.SaveFile(sSavedfile);

                WFloInterface WFIntSaved = new WFloInterface();
                WFIntSaved.AddRef();

                WFIntSaved.OpenFile(sSavedfile);

                MultiFractureData savedMultiFracture = new MultiFractureData();
                savedMultiFracture.AddRef();

                FractureData savedFracture = new FractureData();
                savedFracture.AddRef();

                WFIntSaved.WellModel.AddRef().Layers.AddRef().Item(1).AddRef().GetMultiStageData().AddRef().GetMultiFractureData(0, savedMultiFracture, 0, savedFracture);

                short ChokedModel = savedMultiFracture.ChokedModel;

                Assert.AreEqual(1, ChokedModel);
            }
        }