コード例 #1
0
        public static void Begin(MessageGroupInstance messageGroupInstance)
        {
            int beforeCount = 0;
            int afterCount  = 0;

            // MessageGroupInstance API
            List <MessageGroupInstance> messageGroupInstances;

            // Get existing
            beforeCount = MessageGroupInstanceDAO.Get().Count;

            // Insert and Updating: if ID is included, it will update
            messageGroupInstance = MessageGroupInstanceDAO.PostUpdate(messageGroupInstance);

            // Reading: Use GetMessageGroupInstances() to retrieve a list of obj
            messageGroupInstances = MessageGroupInstanceDAO.Get();

            // get master item count
            afterCount = messageGroupInstances.Count;

            // write
            MessageGroupInstanceTest.Write(messageGroupInstances, "INSERT", beforeCount, afterCount, true);
            Console.Read();

            // make a soft update to some property (Optional)
            // messageGroupInstance.<property> = 1;

            // re-assign the before count
            beforeCount = afterCount;

            // Insert and Updating: if ID is included, it will update
            messageGroupInstance = MessageGroupInstanceDAO.PostUpdate(messageGroupInstance);

            // Reading: Use GetMessageGroupInstances() to retrieve a list of obj
            messageGroupInstances = MessageGroupInstanceDAO.Get();

            // Get existing
            afterCount = MessageGroupInstanceDAO.Get().Count;

            // write
            MessageGroupInstanceTest.Write(messageGroupInstances, "UPDATE", beforeCount, afterCount);
            Console.Read();

            // Reading: Use GetMessageGroupInstances() to retrieve a list of obj w/ 1 item
            messageGroupInstances = MessageGroupInstanceDAO.Get(messageGroupInstance);

            // get count
            afterCount = messageGroupInstances.Count;

            // reassign count
            beforeCount = afterCount;

            // write
            MessageGroupInstanceTest.Write(messageGroupInstances, "Single", afterCount, 1);
            Console.Read();

            // Deleting - Send in the obj w/ at minimal the ID populated
            MessageGroupInstanceDAO.Delete(messageGroupInstance);

            // Reading: Use GetMessageGroupInstances() to retrieve a list of obj
            messageGroupInstances = MessageGroupInstanceDAO.Get();

            // get count
            afterCount = messageGroupInstances.Count;

            // write
            MessageGroupInstanceTest.Write(messageGroupInstances, "Removed", beforeCount, afterCount, true);
            Console.Read();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: cbartholomew/hl7broker
        public static void TestSys()
        {
            Console.WriteLine("APPLICATION TEST");
            ApplicationTest.Begin(new Application()
            {
                description = "TEST INSERT",
                name        = "TEST_CONFIG"
            });

            Console.WriteLine("COLUMN SET TEST");
            ColumnSetTest.Begin(new ColumnSet()
            {
                name         = "TEST_COLUMN",
                isPrimaryKey = false
            });

            Console.WriteLine("COMMUNICATION SET TEST");
            CommunicationTest.Begin(new Communication()
            {
                applicationId = 0
            });

            Console.WriteLine("COMMUNICATION TYPE TEST");
            CommunicationTypeTest.Begin(new CommunicationType()
            {
                name = "Test Communication Type"
            });

            Console.WriteLine("CREDENTIAL TEST");
            CredentialTest.Begin(new Credential()
            {
                username = "******",
                password = "******"
            });

            Console.WriteLine("CREDENTIAL TYPE TEST");
            CredentialTypeTest.Begin(new CredentialType()
            {
                name = "Test Type"
            });

            Console.WriteLine("DATABASE INSTANCE TEST");
            DatabaseInstanceTest.Begin(new DatabaseInstance()
            {
                name            = "Database Instance Test",
                ipAddress       = "0.0.0.0",
                server          = "Test Server",
                communicationId = 0
            });

            Console.WriteLine("DATABASE TABLE TEST");
            DatabaseTableTest.Begin(new DatabaseTable()
            {
                name = "Database Table Instance Test"
            });

            Console.WriteLine("DIRECTION TYPE");
            DirectionTypeTest.Begin(new DirectionType()
            {
                name = "Direction Type Test"
            });

            Console.WriteLine("INTERFACE TEST");
            InterfaceTest.Begin(new Interface()
            {
                ipAddress      = "0.0.0.0",
                maxConnections = 1
            });

            Console.WriteLine("MESSAGE GROUP INSTANCE");
            MessageGroupInstanceTest.Begin(new MessageGroupInstance()
            {
                description = "Message Group Instance Test"
            });

            Console.WriteLine("MESSAGE GROUP");
            MessageGroupTest.Begin(new MessageGroup()
            {
                messageGroupInstanceId = 0,
                messagePartId          = 1,
                position = 1
            });

            Console.WriteLine("MESSAGE PART");
            MessagePartTest.Begin(new MessagePart()
            {
                name      = "TEST",
                delimiter = '+'
            });

            Console.WriteLine("MESSAGE Type TEST");
            MessageTypeTest.Begin(new MessageType()
            {
                name = "ZZ TEST Message Type",
            });

            Console.WriteLine("SEGMENT TYPE");
            SegmentTypeTest.Begin(new SegmentType()
            {
                name = "ZZ SEGMENT Type"
            });

            Console.Read();
        }