public void TestSignatureExtendedCalendarHashChainLengthDiffers() { KsiSignature signature = TestUtil.GetSignature(Resources.KsiSignature_Ok_Extended); TlvTagBuilder builder = GetBuilder(signature); builder.RemoveChildTag(signature.CalendarHashChain[signature.CalendarHashChain.Count - 1]); TestVerificationContext context = new TestVerificationContext() { Signature = signature, ExtendedCalendarHashChain = new CalendarHashChain(builder.BuildTag()) }; Verify(context, VerificationResultCode.Fail, VerificationError.Cal04); }
public void TlvTagBuilderRemoveNullTest() { RawTag child1 = new RawTag(0x1, true, false, new byte[] { 0x1, 0x2 }); CompositeTestTag tag = new CompositeTestTag(0x1, false, false, new ITlvTag[] { child1 }); TlvTagBuilder builder = new TlvTagBuilder(tag); ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { builder.RemoveChildTag(null); }); Assert.AreEqual("childTag", ex.ParamName); }
public void TlvTagBuilderRemoveTest() { RawTag child1 = new RawTag(0x1, true, false, new byte[] { 0x1, 0x2 }); RawTag child2 = new RawTag(0x2, true, false, new byte[] { 0x3, 0x4 }); CompositeTestTag tag = new CompositeTestTag(0x1, false, false, new ITlvTag[] { child1, child2 }); TlvTagBuilder builder = new TlvTagBuilder(tag); builder.RemoveChildTag(child1); CompositeTestTag newTag = new CompositeTestTag(builder.BuildTag()); Assert.AreEqual(1, newTag.Count, "Invalid child tag count."); CollectionAssert.AreEqual(newTag[0].EncodeValue(), child2.EncodeValue(), "Invalid first child."); }