コード例 #1
0
        public void BulkEnrollmentOperation_Constructor_Succeed()
        {
            // arrange
            string expectedJson =
                "{" +
                "    \"mode\":\"create\"," +
                "    \"enrollments\": [ " +
                "      {\n" +
                "        \"registrationId\": \"regid1\",\n" +
                "        \"attestation\": {\n" +
                "          \"type\": \"tpm\",\n" +
                "          \"tpm\": {\n" +
                "            \"endorsementKey\": \"abc=\"\n" +
                "          }\n" +
                "        }\n" +
                "      }," +
                "      {\n" +
                "        \"registrationId\": \"regid2\",\n" +
                "        \"attestation\": {\n" +
                "          \"type\": \"tpm\",\n" +
                "          \"tpm\": {\n" +
                "            \"endorsementKey\": \"abc=\"\n" +
                "          }\n" +
                "        }\n" +
                "      }" +
                "    ]" +
                "}";

            // act
            string bulkJson = BulkEnrollmentOperation.ToJson(BulkOperationMode.Create, individualEnrollments);

            // assert
            TestAssert.AreEqualJson(expectedJson, bulkJson);
        }
コード例 #2
0
 public void BulkEnrollmentOperation_ToJson_ThrowsOnInvalidParameters()
 {
     // arrange - act - assert
     TestAssert.Throws <ArgumentException>(() => BulkEnrollmentOperation.ToJson(BulkOperationMode.Create, null));
     TestAssert.Throws <ArgumentException>(() => BulkEnrollmentOperation.ToJson(BulkOperationMode.Create, new List <IndividualEnrollment>()));
 }