Skip to content

Commit e053cd9

Browse files
committed
fix arctrl.core tests
1 parent 5150773 commit e053cd9

16 files changed

+374
-377
lines changed

tests/ARCtrl/Template.Tests.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ let tests_Spreadsheet = testList "Template_Spreadsheet" [
112112
Expect.equal tags.[4] expectedLast "Last TAG should be equal"
113113

114114
Expect.equal authors.Length 5 "Should be 5 authors"
115-
let expectedFirst = Person.create(FirstName = "Heinrich", LastName = "Weil", MidInitials = "L",ORCID = "0000-0003-1945-6342",Email = "[email protected]")
115+
let expectedFirst = Person.create(firstName = "Heinrich", lastName = "Weil", MidInitials = "L",ORCID = "0000-0003-1945-6342",Email = "[email protected]")
116116
Expect.equal authors.[0] expectedFirst "First AUTHOR should be equal"
117-
let expectedFourth = Person.create(FirstName = "Martin", LastName = "Kuhl")
117+
let expectedFourth = Person.create(firstName = "Martin", lastName = "Kuhl")
118118
Expect.equal authors.[3] expectedFourth "Fourth AUTHOR should be equal"
119119
testCase "complete roundabout" <| fun _ ->
120120
let templateInfo,ers,tags,authors = Spreadsheet.Template.fromMetadataSheet TestObjects.Spreadsheet.Template.templateMetadata

tests/Core/ArcAssay.Tests.fs

+73-69
Large diffs are not rendered by default.

tests/Core/ArcInvestigation.Tests.fs

+37-37
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ open ARCtrl
55
open TestingUtils
66

77
let private assay_Identifier = "MyAssay"
8-
let private assay_MeasurementType = OntologyAnnotation.fromString("My Measurement Type", "MST", "MST:42424242")
8+
let private assay_MeasurementType = OntologyAnnotation("My Measurement Type", "MST", "MST:42424242")
99
let private create_ExampleAssay() = ArcAssay.create(assay_Identifier,assay_MeasurementType)
1010
let private create_ExampleAssays() = ResizeArray([create_ExampleAssay()])
1111

@@ -17,13 +17,13 @@ let private tests_create =
1717
let description = "Investigation Description"
1818
let submissionDate = "2023-07-19"
1919
let publicReleaseDate = "2023-12-31"
20-
let ontologySourceReferences = [|OntologySourceReference.create("Reference 1")|]
21-
let publications = [|Publication.create("Publication 1")|]
22-
let contacts = [|Person.create(FirstName = "John", LastName = "Doe")|]
20+
let ontologySourceReferences = ResizeArray [|OntologySourceReference.create("Reference 1")|]
21+
let publications = ResizeArray [|Publication.create("Publication 1")|]
22+
let contacts = ResizeArray [|Person.create(firstName = "John", lastName = "Doe")|]
2323
let assays = create_ExampleAssays()
2424
let studies = ResizeArray([|ArcStudy.init("Study 1")|])
25-
let comments = [|Comment.create("Comment 1")|]
26-
let remarks = [|Remark.create(1, "Remark 1")|]
25+
let comments = ResizeArray [|Comment.create("Comment 1")|]
26+
let remarks = ResizeArray [|Remark.create(1, "Remark 1")|]
2727

2828
let actual =
2929
ArcInvestigation(
@@ -60,13 +60,13 @@ let private tests_create =
6060
let description = "Investigation Description"
6161
let submissionDate = "2023-07-19"
6262
let publicReleaseDate = "2023-12-31"
63-
let ontologySourceReferences = [|OntologySourceReference.create("Reference 1")|]
64-
let publications = [|Publication.create("Publication 1")|]
65-
let contacts = [|Person.create(FirstName = "John", LastName = "Doe")|]
63+
let ontologySourceReferences = ResizeArray [|OntologySourceReference.create("Reference 1")|]
64+
let publications = ResizeArray [|Publication.create("Publication 1")|]
65+
let contacts = ResizeArray [|Person.create(firstName = "John", lastName = "Doe")|]
6666
let assays = create_ExampleAssays()
67-
let studies = ResizeArray([|ArcStudy.init("Study 1")|])
68-
let comments = [|Comment.create("Comment 1")|]
69-
let remarks = [|Remark.create(1, "Remark 1")|]
67+
let studies = ResizeArray [|ArcStudy.init("Study 1")|]
68+
let comments = ResizeArray [|Comment.create("Comment 1")|]
69+
let remarks = ResizeArray [|Remark.create(1, "Remark 1")|]
7070

7171
let actual = ArcInvestigation.create(
7272
identifier = identifier,
@@ -120,14 +120,14 @@ let private tests_create =
120120
let description = Some "Investigation Description"
121121
let submissionDate = Some "2023-07-19"
122122
let publicReleaseDate = Some "2023-12-31"
123-
let ontologySourceReferences = [|OntologySourceReference.create("Reference 1")|]
124-
let publications = [|Publication.create("Publication 1")|]
125-
let contacts = [|Person.create(FirstName = "John", LastName = "Doe")|]
123+
let ontologySourceReferences = ResizeArray [|OntologySourceReference.create("Reference 1")|]
124+
let publications = ResizeArray [|Publication.create("Publication 1")|]
125+
let contacts = ResizeArray [|Person.create(firstName = "John", lastName = "Doe")|]
126126
let assays = create_ExampleAssays()
127127
let studies = ResizeArray([|ArcStudy.init("Study 1")|])
128128
let registeredStudyIdentifiers = ResizeArray(["Study 1"])
129-
let comments = [|Comment.create("Comment 1")|]
130-
let remarks = [|Remark.create(1, "Remark 1")|]
129+
let comments = ResizeArray [|Comment.create("Comment 1")|]
130+
let remarks = ResizeArray [|Remark.create(1, "Remark 1")|]
131131

132132
let actual =
133133
ArcInvestigation.make
@@ -299,7 +299,7 @@ let tests_MutableFields = testList "MutableFields" [
299299
Expect.equal i.Description None ""
300300
testCase "test mutable fields" <| fun _ ->
301301
let i = ArcInvestigation.init("MyInvestigation")
302-
let persons = [|Person.create(FirstName="Kevin", LastName="Frey")|]
302+
let persons = ResizeArray [|Person.create(firstName="Kevin", lastName="Frey")|]
303303
i.Description <- Some "MyName"
304304
i.Contacts <- persons
305305
i.Title <- Some "Awesome Title"
@@ -328,15 +328,15 @@ let tests_MutableFields = testList "MutableFields" [
328328
let tests_Copy = testList "Copy" [
329329
testCase "test mutable fields" <| fun _ ->
330330
let i = ArcInvestigation.init("MyInvestigation")
331-
let persons = [|Person.create(FirstName="Kevin", LastName="Frey")|]
331+
let persons = ResizeArray [|Person.create(firstName="Kevin", lastName="Frey")|]
332332
i.Description <- Some "MyName"
333333
i.Contacts <- persons
334334
i.Title <- Some "Awesome Title"
335335
Expect.equal i.Description (Some "MyName") "FileName"
336336
Expect.equal i.Contacts persons "Contacts"
337337
Expect.equal i.Title (Some "Awesome Title") "Title"
338338
let copy = i.Copy()
339-
let nextPersons = [|Person.create(FirstName="Pascal", LastName="Gevangen")|]
339+
let nextPersons = ResizeArray [|Person.create(firstName="Pascal", lastName="Gevangen")|]
340340
copy.Description <- Some "Next FileName"
341341
copy.Contacts <- nextPersons
342342
copy.Title <- Some "Next Title"
@@ -348,7 +348,7 @@ let tests_Copy = testList "Copy" [
348348
Expect.equal copy.Title (Some "Next Title") "copy Title"
349349
testCase "test mutable fields on study" <| fun _ ->
350350
let i = ArcInvestigation.init("MyInvestigation")
351-
let persons = [|Person.create(FirstName="Kevin", LastName="Frey")|]
351+
let persons = ResizeArray [|Person.create(firstName="Kevin", lastName="Frey")|]
352352
i.Description <- Some "MyName"
353353
i.Contacts <- persons
354354
i.Title <- Some "Awesome Title"
@@ -363,7 +363,7 @@ let tests_Copy = testList "Copy" [
363363
Expect.equal sNext.Description (Some "My Test Desciption") "study description"
364364
// Create `copy` and change params. Then `i` should still be the same while `copy` must be changed
365365
let copy = i.Copy()
366-
let nextPersons = [|Person.create(FirstName="Pascal", LastName="Gevangen")|]
366+
let nextPersons = ResizeArray [|Person.create(firstName="Pascal", lastName="Gevangen")|]
367367
copy.Description <- Some "Next FileName"
368368
copy.Contacts <- nextPersons
369369
copy.Title <- Some "Next Title"
@@ -489,7 +489,7 @@ let tests_Assay = testList "CRUD Assay" [
489489
testCase "by index" <| fun _ ->
490490
let i = createExampleInvestigation()
491491
let assay_ident = "New Assay"
492-
let assay_techPlatform = OntologyAnnotation.fromString("Assay Tech")
492+
let assay_techPlatform = OntologyAnnotation("Assay Tech")
493493
let expected = ArcAssay(assay_ident, technologyPlatform = assay_techPlatform)
494494
i.AddAssay(expected)
495495
i.RegisterAssayAt(0, expected.Identifier)
@@ -501,7 +501,7 @@ let tests_Assay = testList "CRUD Assay" [
501501
testCase "by identifier" <| fun _ ->
502502
let i = createExampleInvestigation()
503503
let assay_ident = "New Assay"
504-
let assay_techPlatform = OntologyAnnotation.fromString("Assay Tech")
504+
let assay_techPlatform = OntologyAnnotation("Assay Tech")
505505
let expected = ArcAssay(assay_ident, technologyPlatform = assay_techPlatform)
506506
i.AddAssay(expected)
507507
i.RegisterAssay("Study 1", expected.Identifier)
@@ -515,7 +515,7 @@ let tests_Assay = testList "CRUD Assay" [
515515
testCase "by index" <| fun _ ->
516516
let i = createExampleInvestigation()
517517
let assay_ident = "New Assay"
518-
let assay_techPlatform = OntologyAnnotation.fromString("Assay Tech")
518+
let assay_techPlatform = OntologyAnnotation("Assay Tech")
519519
let expected = ArcAssay(assay_ident, technologyPlatform = assay_techPlatform)
520520
i.SetAssayAt(0, expected)
521521
Expect.equal i.StudyCount 2 "StudyCount"
@@ -526,7 +526,7 @@ let tests_Assay = testList "CRUD Assay" [
526526
testCase "by index tpOntology" <| fun _ ->
527527
let i = createExampleInvestigation()
528528
let assay_ident = "New Assay"
529-
let assay_techPlatform = OntologyAnnotation.fromString("Assay Tech","ABC","ABC:123")
529+
let assay_techPlatform = OntologyAnnotation("Assay Tech","ABC","ABC:123")
530530
let expected = ArcAssay(assay_ident, technologyPlatform = assay_techPlatform)
531531
i.SetAssayAt(0, expected)
532532
Expect.equal i.StudyCount 2 "StudyCount"
@@ -537,7 +537,7 @@ let tests_Assay = testList "CRUD Assay" [
537537
testCase "by identifier" <| fun _ ->
538538
let i = createExampleInvestigation()
539539
let assay_ident = "New Assay"
540-
let assay_techPlatform = OntologyAnnotation.fromString("Assay Tech")
540+
let assay_techPlatform = OntologyAnnotation("Assay Tech")
541541
let expected = ArcAssay(assay_ident, technologyPlatform = assay_techPlatform)
542542
i.SetAssay("Assay 2", expected)
543543
Expect.equal i.StudyCount 2 "StudyCount"
@@ -562,7 +562,7 @@ let tests_Assay = testList "CRUD Assay" [
562562
Expect.equal a.Identifier "Assay 2" "FileName"
563563
testCase "mutable propagation" <| fun _ ->
564564
let i = createExampleInvestigation()
565-
let tech = Some (OntologyAnnotation.fromString("New Tech Stuff"))
565+
let tech = Some (OntologyAnnotation("New Tech Stuff"))
566566
let a = i.GetAssayAt(0)
567567
Expect.equal a.Identifier "Assay 1" "FileName"
568568
Expect.equal a.TechnologyPlatform None "TechnologyPlatform"
@@ -572,7 +572,7 @@ let tests_Assay = testList "CRUD Assay" [
572572
testCase "mutable propagation, copy" <| fun _ ->
573573
let i = createExampleInvestigation()
574574
let copy = createExampleInvestigation()
575-
let tech = Some (OntologyAnnotation.fromString("New Tech Stuff"))
575+
let tech = Some (OntologyAnnotation("New Tech Stuff"))
576576
let a = i.GetAssayAt(0)
577577
Expect.equal a.Identifier "Assay 1" "FileName"
578578
Expect.equal a.TechnologyPlatform None "TechnologyPlatform"
@@ -706,14 +706,14 @@ let private tests_GetHashCode = testList "GetHashCode" [
706706
(Some "My Inv Description")
707707
(Some "My Inv SubmissionDate")
708708
(Some "My Inv PRD")
709-
[|OntologySourceReference.create("Some Lorem ipsum description", Name="Descriptore"); OntologySourceReference.empty|]
710-
[|Publication.empty; Publication.create(Title="Some nice title")|]
711-
([|Person.create(FirstName="John",LastName="Doe"); Person.create(FirstName="Jane",LastName="Doe")|])
712-
(ResizeArray([ArcAssay.init("Registered Assay1"); ArcAssay.init("Registered Assay2")]))
713-
(ResizeArray([ArcStudy.init("Registered Study1"); ArcStudy.init("Registered Study2")]))
714-
(ResizeArray(["Registered Study1"; "Registered Study2"]))
715-
([|Comment.create("Hello", "World"); Comment.create("ByeBye", "World") |])
716-
[|Remark.create(12,"Test"); Remark.create(42, "The answer")|]
709+
(ResizeArray [|OntologySourceReference("Some Lorem ipsum description", name="Descriptore"); OntologySourceReference.empty|])
710+
(ResizeArray [|Publication(); Publication(title="Some nice title")|])
711+
(ResizeArray [|Person(firstName="John",lastName="Doe"); Person(firstName="Jane",lastName="Doe")|])
712+
(ResizeArray ([ArcAssay.init("Registered Assay1"); ArcAssay.init("Registered Assay2")]))
713+
(ResizeArray ([ArcStudy.init("Registered Study1"); ArcStudy.init("Registered Study2")]))
714+
(ResizeArray (["Registered Study1"; "Registered Study2"]))
715+
(ResizeArray [|Comment("Hello", "World"); Comment("ByeBye", "World") |])
716+
(ResizeArray [|Remark.create(12,"Test"); Remark.create(42, "The answer")|])
717717
let copy = actual.Copy()
718718
Expect.equal (actual.GetHashCode()) (copy.GetHashCode()) ""
719719
testCase "not equal" <| fun _ ->

0 commit comments

Comments
 (0)