Version 2.1 #41
|
@ -32,16 +32,16 @@ let nodaTests =
|
|||
let accessLevelTests =
|
||||
testList "AccessLevel" [
|
||||
testList "Parse" [
|
||||
test "\"Author\" succeeds" {
|
||||
test "succeeds for \"Author\"" {
|
||||
Expect.equal Author (AccessLevel.Parse "Author") "Author not parsed correctly"
|
||||
}
|
||||
test "\"Editor\" succeeds" {
|
||||
test "succeeds for \"Editor\"" {
|
||||
Expect.equal Editor (AccessLevel.Parse "Editor") "Editor not parsed correctly"
|
||||
}
|
||||
test "\"WebLogAdmin\" succeeds" {
|
||||
test "succeeds for \"WebLogAdmin\"" {
|
||||
Expect.equal WebLogAdmin (AccessLevel.Parse "WebLogAdmin") "WebLogAdmin not parsed correctly"
|
||||
}
|
||||
test "\"Administrator\" succeeds" {
|
||||
test "succeeds for \"Administrator\"" {
|
||||
Expect.equal Administrator (AccessLevel.Parse "Administrator") "Administrator not parsed correctly"
|
||||
}
|
||||
test "fails when given an unrecognized value" {
|
||||
|
@ -115,5 +115,72 @@ let accessLevelTests =
|
|||
]
|
||||
]
|
||||
|
||||
/// Tests for the CommentStatus type
|
||||
let commentStatusTests =
|
||||
testList "CommentStatus" [
|
||||
testList "Parse" [
|
||||
test "succeeds for \"Approved\"" {
|
||||
Expect.equal Approved (CommentStatus.Parse "Approved") "Approved not parsed correctly"
|
||||
}
|
||||
test "succeeds for \"Pending\"" {
|
||||
Expect.equal Pending (CommentStatus.Parse "Pending") "Pending not parsed correctly"
|
||||
}
|
||||
test "succeeds for \"Spam\"" {
|
||||
Expect.equal Spam (CommentStatus.Parse "Spam") "Spam not parsed correctly"
|
||||
}
|
||||
test "fails for unrecognized value" {
|
||||
Expect.throwsT<ArgumentException>
|
||||
(fun () -> ignore (CommentStatus.Parse "Live")) "Invalid value should have raised an exception"
|
||||
}
|
||||
]
|
||||
testList "ToString" [
|
||||
test "Approved succeeds" {
|
||||
Expect.equal (string Approved) "Approved" "Approved string incorrect"
|
||||
}
|
||||
test "Pending succeeds" {
|
||||
Expect.equal (string Pending) "Pending" "Pending string incorrect"
|
||||
}
|
||||
test "Spam succeeds" {
|
||||
Expect.equal (string Spam) "Spam" "Spam string incorrect"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
let explicitRatingTests =
|
||||
testList "ExplicitRating" [
|
||||
testList "Parse" [
|
||||
test "succeeds for \"yes\"" {
|
||||
Expect.equal Yes (ExplicitRating.Parse "yes") "\"yes\" not parsed correctly"
|
||||
}
|
||||
test "succeeds for \"no\"" {
|
||||
Expect.equal No (ExplicitRating.Parse "no") "\"no\" not parsed correctly"
|
||||
}
|
||||
test "succeeds for \"clean\"" {
|
||||
Expect.equal Clean (ExplicitRating.Parse "clean") "\"clean\" not parsed correctly"
|
||||
}
|
||||
test "fails for unrecognized value" {
|
||||
Expect.throwsT<ArgumentException>
|
||||
(fun () -> ignore (ExplicitRating.Parse "maybe")) "Invalid value should have raised an exception"
|
||||
}
|
||||
]
|
||||
testList "ToString" [
|
||||
test "Yes succeeds" {
|
||||
Expect.equal (string Yes) "yes" "Yes string incorrect"
|
||||
}
|
||||
test "No succeeds" {
|
||||
Expect.equal (string No) "no" "No string incorrect"
|
||||
}
|
||||
test "Clean succeeds" {
|
||||
Expect.equal (string Clean) "clean" "Clean string incorrect"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
/// All tests for the Domain namespace
|
||||
let all = testList "Domain" [ nodaTests; accessLevelTests ]
|
||||
let all =
|
||||
testList
|
||||
"Domain"
|
||||
[ nodaTests
|
||||
accessLevelTests
|
||||
commentStatusTests
|
||||
explicitRatingTests ]
|
||||
|
|
Loading…
Reference in New Issue
Block a user