public void ThenRepositoryGetsReferenceIdElements(string id) { // Arrange var repository = new SignedXmlRepository(_document); // Act XmlElement idElement = repository.GetReferenceIdElement(id); // Assert Assert.NotNull(idElement); }
public void ThenRepositoryFailsWhenGettingReferenceIdElements() { // Arrange var document = new XmlDocument(); var repository = new SignedXmlRepository(document); const string notExistingId = "not-existing-id"; // Act XmlElement idElement = repository.GetReferenceIdElement(notExistingId); // Assert Assert.Null(idElement); }
public void Fails_IfMalformedDocument() { // Arrange var document = new XmlDocument(); document.LoadXml( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<s12:Envelope xmlns:s12=\"http://www.w3.org/2003/05/soap-envelope\">" + "<s12:Body p2:Id=\"body-efc3a86d-ca12-4697-a9cf-85be4334dd41\" xmlns:p2=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"/>" + "<s12:Body p2:Id=\"body-efc3a86d-ca12-4697-a9cf-85be4334dd41\" xmlns:p2=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"/>" + "<s12:Body p2:Id=\"body-efc3a86d-ca12-4697-a9cf-85be4334dd41\" xmlns:p2=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"/>" + "</s12:Envelope>"); var sut = new SignedXmlRepository(document); // Act / Assert Assert.ThrowsAny <CryptographicException>( () => sut.GetReferenceIdElement("body-efc3a86d-ca12-4697-a9cf-85be4334dd41")); }