Skip to content

Commit e1506e3

Browse files
authored
Merge pull request #3395 from Open-Systems-Pharmacology/3394-add-registration-for-ospsuitecoreicoreusersettings-in-pksimr
Fixes #3394 Add registration for OSPSuite.Core.ICoreUserSettings in P…
2 parents c19cacf + 41c605c commit e1506e3

File tree

6 files changed

+174
-1
lines changed

6 files changed

+174
-1
lines changed

src/PKSim.R/Bootstrap/ApplicationStartup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private IContainer performInitialization()
7070
private void registerMinimalImplementations(IContainer container)
7171
{
7272
container.Register<ICoreWorkspace, IWorkspace, CLIWorkspace>(LifeStyle.Singleton);
73-
container.Register<ICoreUserSettings, CLIUserSettings>(LifeStyle.Singleton);
73+
container.Register<OSPSuite.Core.ICoreUserSettings, ICoreUserSettings, CLIUserSettings>(LifeStyle.Singleton);
7474
container.Register<IProgressUpdater, NoneProgressUpdater>();
7575
container.Register<IOntogenyTask, CLIIndividualOntogenyTask>();
7676
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using NUnit.Framework;
3+
using OSPSuite.BDDHelper;
4+
5+
namespace PKSim.R;
6+
7+
[IntegrationTests]
8+
[Category("R")]
9+
public abstract class ContextForStaticIntegration : StaticContextSpecification
10+
{
11+
public override void GlobalContext()
12+
{
13+
base.GlobalContext();
14+
Api.InitializeOnce();
15+
16+
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
17+
}
18+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"Version": 76,
3+
"Individuals": [
4+
{
5+
"Name": "Acosta2007",
6+
"Seed": 8908561,
7+
"OriginData": {
8+
"CalculationMethods": [
9+
"SurfaceAreaPlsInt_VAR1",
10+
"Body surface area - Mosteller"
11+
],
12+
"Species": "Human",
13+
"Population": "WhiteAmerican_NHANES_1997",
14+
"Gender": "MALE",
15+
"Age": {
16+
"Value": 34.0,
17+
"Unit": "year(s)"
18+
},
19+
"Weight": {
20+
"Value": 78.0,
21+
"Unit": "kg"
22+
}
23+
},
24+
"Molecules": [
25+
{
26+
"Name": "CYP3A4",
27+
"Type": "Enzyme",
28+
"MembraneLocation": "Apical",
29+
"TissueLocation": "Intracellular",
30+
"IntracellularVascularEndoLocation": "Endosomal",
31+
"Expression": [
32+
{
33+
"Name": "Brain",
34+
"Value": 0.0041682898325
35+
},
36+
{
37+
"Name": "Gonads",
38+
"Value": 0.00078691079081
39+
},
40+
{
41+
"Name": "Kidney",
42+
"Value": 0.0053603428126
43+
},
44+
{
45+
"Name": "Periportal",
46+
"Value": 1.0
47+
},
48+
{
49+
"Name": "Pericentral",
50+
"Value": 1.0
51+
},
52+
{
53+
"Name": "Lung",
54+
"Value": 0.00042695753798
55+
},
56+
{
57+
"Name": "SmallIntestine",
58+
"Value": 0.0727697702
59+
},
60+
{
61+
"Name": "Duodenum",
62+
"Value": 0.0727697702
63+
},
64+
{
65+
"Name": "UpperJejunum",
66+
"Value": 0.0727697702
67+
},
68+
{
69+
"Name": "LowerJejunum",
70+
"Value": 0.0727697702
71+
},
72+
{
73+
"Name": "UpperIleum",
74+
"Value": 0.0727697702
75+
},
76+
{
77+
"Name": "LowerIleum",
78+
"Value": 0.0727697702
79+
}
80+
],
81+
"Ontogeny": {
82+
"Name": "CYP3A4"
83+
},
84+
"Parameters": [
85+
{
86+
"Name": "t1/2 (liver)",
87+
"Value": 22.0,
88+
"Unit": "h",
89+
"ValueOrigin": {
90+
"Source": "Unknown"
91+
}
92+
}
93+
]
94+
}
95+
]
96+
}
97+
]
98+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace PKSim.R;
5+
6+
internal static class DomainHelperForSpecs
7+
{
8+
private static readonly string _pathToData = "..\\..\\..\\Data\\";
9+
10+
public static string DataFilePathFor(string fileNameWithExtension) => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _pathToData, fileNameWithExtension);
11+
}

tests/PKSim.R.Tests/PKSim.R.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
</ItemGroup>
5555

5656
<ItemGroup>
57+
<Folder Include="Data\" />
5758
<Folder Include="Properties\" />
5859
</ItemGroup>
5960

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using OSPSuite.BDDHelper;
3+
using OSPSuite.BDDHelper.Extensions;
4+
using OSPSuite.CLI.Core.RunOptions;
5+
using OSPSuite.CLI.Core.Services;
6+
using OSPSuite.Utility;
7+
using System.IO;
8+
9+
namespace PKSim.R;
10+
11+
internal class RunSnapshotSpecs : ContextForStaticIntegration
12+
{
13+
private readonly string _inputFolder = @"C:\Input\";
14+
private readonly string _outputFolder = @"C:\Output\";
15+
16+
protected override void Context()
17+
{
18+
base.Context();
19+
var runOptions = new SnapshotRunOptions
20+
{
21+
InputFolder = _inputFolder,
22+
OutputFolder = _outputFolder,
23+
ExportMode = SnapshotExportMode.Project
24+
};
25+
26+
DirectoryHelper.CreateDirectory(_inputFolder);
27+
FileHelper.Copy(DomainHelperForSpecs.DataFilePathFor("Atazanavir-Model_1Sim.json"), Path.Join(_inputFolder, "Atazanavir-Model_1Sim.json"));
28+
29+
Api.RunSnapshot(runOptions);
30+
}
31+
32+
[Observation]
33+
public void the_output_folder_contains_one_pksim5_file()
34+
{
35+
Directory.Exists(_outputFolder).ShouldBeTrue();
36+
File.Exists(Path.Join(_outputFolder, "Atazanavir-Model_1Sim.pksim5")).ShouldBeTrue();
37+
}
38+
39+
public override void Cleanup()
40+
{
41+
base.Cleanup();
42+
DirectoryHelper.DeleteDirectory(_outputFolder, true);
43+
DirectoryHelper.DeleteDirectory(_inputFolder, true);
44+
}
45+
}

0 commit comments

Comments
 (0)