-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish basic property tests for isa profile types
- Loading branch information
Showing
14 changed files
with
422 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,61 @@ | ||
module Tests.Data | ||
|
||
open ARCtrl.ROCrate | ||
open DynamicObj | ||
|
||
open TestingUtils | ||
open Common | ||
|
||
let mandatory_properties = Data( | ||
id = "data_mandatory_properties_id", | ||
name = "name" | ||
) | ||
|
||
let all_properties = Data( | ||
id = "data_all_properties_id", | ||
name = "name", | ||
additionalType = "additionalType", | ||
comment = "comment", | ||
encodingFormat = "encodingFormat", | ||
disambiguatingDescription = "disambiguatingDescription" | ||
) | ||
|
||
let tests_profile_object_is_valid = testList "constructed properties" [ | ||
testList "mandatory properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "data_mandatory_properties_id" mandatory_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/MediaObject" mandatory_properties | ||
testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties | ||
] | ||
testList "all properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "data_all_properties_id" all_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/MediaObject" all_properties | ||
testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties | ||
testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties | ||
testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties | ||
testCase "encodingFormat" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "encodingFormat" "encodingFormat" all_properties | ||
testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties | ||
] | ||
] | ||
|
||
let tests_profile_object_is_valid = testList "profile object is valid" [] | ||
|
||
let tests_static_methods = testList "static methods" [] | ||
|
||
let tests_interface_members = testList "interface members" [] | ||
let tests_interface_members = testList "interface members" [ | ||
testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/MediaObject" "data_mandatory_properties_id" None mandatory_properties | ||
testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/MediaObject" "data_all_properties_id" (Some "additionalType") all_properties | ||
] | ||
|
||
let tests_dynamic_members = testList "dynamic members" [] | ||
let tests_dynamic_members = testSequenced ( | ||
testList "dynamic members" [ | ||
testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" | ||
testCase "Set dynamic property" <| fun _ -> | ||
mandatory_properties.SetValue("yes",42) | ||
Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties | ||
testCase "Remove dynamic property" <| fun _ -> | ||
mandatory_properties.Remove("yes") | ||
Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" | ||
] | ||
) | ||
|
||
let main = testList "Data" [ | ||
tests_profile_object_is_valid | ||
tests_static_methods | ||
tests_interface_members | ||
tests_dynamic_members | ||
] | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,69 @@ | ||
module Tests.LabProtocol | ||
|
||
open ARCtrl.ROCrate | ||
open DynamicObj | ||
|
||
open TestingUtils | ||
open Common | ||
|
||
let tests_profile_object_is_valid = testList "profile object is valid" [] | ||
let mandatory_properties = LabProtocol( | ||
id = "labprotocol_mandatory_properties_id" | ||
) | ||
|
||
let tests_static_methods = testList "static methods" [] | ||
let all_properties = LabProtocol( | ||
id = "labprotocol_all_properties_id", | ||
additionalType = "additionalType", | ||
name = "name", | ||
intendedUse = "intendedUse", | ||
description = "description", | ||
url = "url", | ||
comment = "comment", | ||
version = "version", | ||
labEquipment = "labEquipment", | ||
reagent = "reagent", | ||
computationalTool = "computationalTool" | ||
) | ||
|
||
let tests_interface_members = testList "interface members" [] | ||
let tests_profile_object_is_valid = testList "constructed properties" [ | ||
testList "mandatory properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprotocol_mandatory_properties_id" mandatory_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProtocol" mandatory_properties | ||
] | ||
testList "all properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprotocol_all_properties_id" all_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProtocol" all_properties | ||
testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties | ||
testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties | ||
testCase "intendedUse" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "intendedUse" "intendedUse" all_properties | ||
testCase "description" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "description" "description" all_properties | ||
testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties | ||
testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties | ||
testCase "version" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "version" "version" all_properties | ||
testCase "labEquipment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "labEquipment" "labEquipment" all_properties | ||
testCase "reagent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "reagent" "reagent" all_properties | ||
testCase "computationalTool" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "computationalTool" "computationalTool" all_properties | ||
] | ||
] | ||
|
||
let tests_dynamic_members = testList "dynamic members" [] | ||
let tests_interface_members = testList "interface members" [ | ||
testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProtocol" "labprotocol_mandatory_properties_id" None mandatory_properties | ||
testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProtocol" "labprotocol_all_properties_id" (Some "additionalType") all_properties | ||
] | ||
|
||
let tests_dynamic_members = testSequenced ( | ||
testList "dynamic members" [ | ||
testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" | ||
testCase "Set dynamic property" <| fun _ -> | ||
mandatory_properties.SetValue("yes",42) | ||
Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties | ||
testCase "Remove dynamic property" <| fun _ -> | ||
mandatory_properties.Remove("yes") | ||
Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" | ||
] | ||
) | ||
|
||
let main = testList "LabProtocol" [ | ||
tests_profile_object_is_valid | ||
tests_static_methods | ||
tests_interface_members | ||
tests_dynamic_members | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,75 @@ | ||
module Tests.Person | ||
|
||
open ARCtrl.ROCrate | ||
open DynamicObj | ||
|
||
open TestingUtils | ||
open Common | ||
|
||
let tests_profile_object_is_valid = testList "profile object is valid" [] | ||
let mandatory_properties = Person( | ||
id = "person_mandatory_properties_id", | ||
givenName = "givenName" | ||
) | ||
|
||
let tests_static_methods = testList "static methods" [] | ||
let all_properties = Person( | ||
id = "person_all_properties_id", | ||
givenName = "givenName", | ||
additionalType = "additionalType", | ||
familyName = "familyName", | ||
email = "email", | ||
identifier = "identifier", | ||
affiliation = "affiliation", | ||
jobTitle = "jobTitle", | ||
additionalName = "additionalName", | ||
address = "address", | ||
telephone = "telephone", | ||
faxNumber = "faxNumber", | ||
disambiguatingDescription = "disambiguatingDescription" | ||
) | ||
|
||
let tests_interface_members = testList "interface members" [] | ||
let tests_profile_object_is_valid = testList "constructed properties" [ | ||
testList "mandatory properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "person_mandatory_properties_id" mandatory_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Person" mandatory_properties | ||
testCase "givenName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "givenName" "givenName" all_properties | ||
] | ||
testList "all properties" [ | ||
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "person_mandatory_properties_id" mandatory_properties | ||
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Person" mandatory_properties | ||
testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties | ||
testCase "givenName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "givenName" "givenName" all_properties | ||
testCase "familyName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "familyName" "familyName" all_properties | ||
testCase "email" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "email" "email" all_properties | ||
testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties | ||
testCase "affiliation" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "affiliation" "affiliation" all_properties | ||
testCase "jobTitle" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "jobTitle" "jobTitle" all_properties | ||
testCase "additionalName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "additionalName" "additionalName" all_properties | ||
testCase "address" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "address" "address" all_properties | ||
testCase "telephone" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "telephone" "telephone" all_properties | ||
testCase "faxNumber" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "faxNumber" "faxNumber" all_properties | ||
testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties | ||
] | ||
] | ||
|
||
let tests_interface_members = testList "interface members" [ | ||
testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Person" "person_mandatory_properties_id" None mandatory_properties | ||
testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Person" "person_all_properties_id" (Some "additionalType") all_properties | ||
] | ||
|
||
let tests_dynamic_members = testList "dynamic members" [] | ||
let tests_dynamic_members = testSequenced ( | ||
testList "dynamic members" [ | ||
testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" | ||
testCase "Set dynamic property" <| fun _ -> | ||
mandatory_properties.SetValue("yes",42) | ||
Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties | ||
testCase "Remove dynamic property" <| fun _ -> | ||
mandatory_properties.Remove("yes") | ||
Expect.isNone (DynObj.tryGetTypedValue<int> "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" | ||
] | ||
) | ||
|
||
let main = testList "Person" [ | ||
tests_profile_object_is_valid | ||
tests_static_methods | ||
tests_interface_members | ||
tests_dynamic_members | ||
] | ||
] |
Oops, something went wrong.