예제 #1
0
		public void ValidateReadSignatureOutputStructure()
		{
			var tester = new FunctionTester<ReadProvider>();
			FunctionDesigner designer = tester.CreateDesigner();
			Assert.IsNull(designer.Output);

			Property readSignature = designer.Properties[PropertyNames.ReadSignature];
			Assert.IsFalse(readSignature.GetValue<bool>());
			readSignature.Value = true;

			IEnumerable<ITypeProperty> properties = designer.Output.GetProperties();
			Assert.AreEqual(1, properties.Count());
			properties.ElementAt(0).AssertGenerated(OutputNames.Signatures);

			properties = properties.ElementAt(0).TypeReference.GetProperties();
			Assert.AreEqual(3, properties.Count());
			properties.ElementAt(0).AssertCompiled(OutputNames.IsSigned, typeof(bool));
			properties.ElementAt(1).AssertGenerated(OutputNames.LatestSignature);
			ITypeReference signatureType = properties.ElementAt(1).TypeReference;
			properties.ElementAt(2).AssertList(OutputNames.AllSignatures, signatureType);

			properties = signatureType.GetProperties();
			Assert.AreEqual(9, properties.Count());
			properties.ElementAt(0).AssertCompiled(OutputNames.SignedBy, typeof(string));
			properties.ElementAt(1).AssertCompiled(OutputNames.SignedAt, typeof(string));
			properties.ElementAt(2).AssertCompiled(OutputNames.Reason, typeof(string));
			properties.ElementAt(3).AssertCompiled(OutputNames.SignedOn, typeof(DateTime));
			properties.ElementAt(4).AssertCompiled(OutputNames.Unmodified, typeof(bool));
			properties.ElementAt(5).AssertCompiled(OutputNames.SignedRevision, typeof(int));
			properties.ElementAt(6).AssertCompiled(OutputNames.IsLatestRevision, typeof(bool));
			properties.ElementAt(7).AssertCompiled(OutputNames.Verified, typeof(bool));
			properties.ElementAt(8).AssertCompiled(OutputNames.VerificationMessage, typeof(string));
		}
        private void BuildOutput()
        {
            var outputBuilder = new TypeBuilder();

            BuildTextOutput(outputBuilder);
            BuildSignatureOutput(outputBuilder);
            BuildFormDataOutput(outputBuilder);

            ITypeReference outputReference = outputBuilder.CreateTypeReference();

            Output = (outputReference.GetProperties().Any()) ? outputReference : null;
        }