Exemple #1
0
 public void Test_10_Navigation()
 {
     DataStructures.Node root = new DataStructures.Node();
     NodeTestData.AddTestChildren(root);
     NodeTestData.AssertTestChildren(root);
     return;
 }
Exemple #2
0
 public void Test_00_TextGraph()
 {
     DataStructures.Node root = new DataStructures.Node();
     NodeTestData.AddTestChildren(root);
     Console.WriteLine(root.TextGraph());
     return;
 }
Exemple #3
0
 public void Test_20_Clone()
 {
     DataStructures.Node root = new DataStructures.Node();
     NodeTestData.AddTestChildren(root);
     DataStructures.Node.CloningVisitor visitor = new DataStructures.Node.CloningVisitor(root);
     root.VisitNodes(visitor, DataStructures.VisitationType.DecendentsDepthFirst);
     NodeTestData.AssertTestChildren(visitor.TargetRoot);
     return;
 }
	public void Test_00_DebugOutput()
	{
		DataStructures.Node root = new DataStructures.Node( "", "", new DebugOutputNodeListener() );
		root.Value = "root";
		root.Notify(
			new DataStructures.Node.NodeUpdateNotification(
				DataStructures.Node.NodeNotification.NotificationStatus.Completed
				, root ) );
		NodeTestData.AddTestChildren( root );
		return;
	}
Exemple #5
0
        public static TestRequest CreateRequestFor(MethodToTest methodToTest, NodeTestData testData)
        {
            switch (methodToTest)
            {
            case MethodToTest.GetBlockCount:
                return(new GetBlockCount());

            case MethodToTest.GetTransaction:
                return(new GetTransaction(testData.GetTxId(), null));

            case MethodToTest.GetRawTransaction:
                return(new GetRawTransaction(testData.GetTxId(), 1, null));

            case MethodToTest.DecodeRawTransaction:
                return(new DecodeRawTransaction(testData.GetRawHex(), null));

            case MethodToTest.ValidateAddress:
                return(new ValidateAddress(testData.GetAddress()));

            case MethodToTest.GetBlockHash:
                return(new GetBlockHash(testData.BlockCount));

            case MethodToTest.GetBlock:
                return(new GetBlock(testData.BlockHash, null));

            case MethodToTest.GetBalance:
                return(new GetBalance(null, null, null));

            case MethodToTest.ListUnspent:
                return(new ListUnspent(null, null, null, null, null));

            case MethodToTest.ListAddressGroupings:
                return(new ListAddressGroupings());

            case MethodToTest.SendMany:
                List <Tests.SendMany.Destination> destinations = new List <Tests.SendMany.Destination> {
                    new Tests.SendMany.Destination(testData.GetAddress(0), 1, false),
                    new Tests.SendMany.Destination(testData.GetAddress(1), 1, true),
                    new Tests.SendMany.Destination(testData.GetAddress(2), 1, true),
                };
                var    amounts     = destinations.ToDictionary(d => d.DestinationAddress, d => d.Amount);
                string jsonAmounts = JsonConvert.SerializeObject(amounts);

                var    subtractFees     = destinations.Where(dest => dest.SubtractFees).Select(dest => dest.DestinationAddress).Distinct().ToArray();
                string jsonSubtractFees = JsonConvert.SerializeObject(subtractFees);

                CallRequest.SendMany request = new CallRequest.SendMany(string.Empty, jsonAmounts, null, null, jsonSubtractFees, null, null, "UNSET");
                return(request);

            default:
                throw new Exception("Unknown method to test.");
            }
        }
    public void Test_10_CountingVisitorOnRoot()
    {
        DataStructures.Node root = new DataStructures.Node();
        NodeTestData.AddTestChildren(root);

        this._AssertCountingVisitor(root, DataStructures.VisitationType.None, 0);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.Parents, 0);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.PreviousSiblings, 0);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.NextSiblings, 0);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.PreviousNodes, 0);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.NextNodes, 14);
        this._AssertCountingVisitor(root, DataStructures.VisitationType.Children, 1);
        // Not Implemented: this._AssertCountingVisitor( root, DataStructures.VisitationType.DecendentsBreadthFirst, 0 );
        this._AssertCountingVisitor(root, DataStructures.VisitationType.DecendentsDepthFirst, 14);

        return;
    }
 public TestSummary(NodeTestData nodeTestData)
 {
     this.nodeTestData = nodeTestData;
     this.Details      = new Dictionary <string, List <Detail> >();
 }