public void ValidLicenseIsValidatedWithoutErrors() { var token = CreateJws(id: "12345", audience: "testaudience", issuer: "testissuer", expires: now.AddDays(1), issuedAt: now, notBefore: now.AddMinutes(-10), module: "modulename", device: "myedgehost", iothub: "myiothub", issuerSigningKey: issuerCertificateWithPrivateKey); JwsLicenseValidation.Validate(token, issuerCertificatePublicKeyOnly, expectedTokenId: "12345", validAudience: "testaudience", validIssuer: "testissuer", now, moduleInstanceName: "modulename", hostName: "myedgehost", hubName: "myiothub"); }
public void IncorrectIoTHubNameErrorIsThrownCorrectly() { var token = CreateJws(id: "12345", audience: "testaudience", issuer: "testissuer", expires: now.AddDays(1), issuedAt: now, notBefore: now.AddMinutes(-10), module: "modulename", device: "myedgehost", iothub: "myiothub", issuerSigningKey: issuerCertificateWithPrivateKey); Assert.ThrowsException <Exception>(() => JwsLicenseValidation.Validate(token, issuerCertificatePublicKeyOnly, expectedTokenId: "12345", validAudience: "testaudience", validIssuer: "testissuer", now, moduleInstanceName: "modulename", hostName: "myedgehost", hubName: "INCORRECT")); }