func TestOutPort_BindToPort(t *testing.T) {
	assert := assert.New(t)
	var outPort = NewOutPort(LocalOutPortId)
	assert.NotNil(outPort, "FAILED: failed to create OutPort")
	outPutFunc := func(msg interface{}) error {
		return nil
	}
	outPort.BindToPort(outPutFunc)
	assert.Condition(
		func() (success bool) {
			return len(outPort.outPutFuncs) == 1
		}, "FAILESD: failed to bind OutPutFunc to OutPort")
}
Test bind OutPutFunc to OutPort
package port
import (
	"github.com/DSiSc/craft/types"
	"github.com/stretchr/testify/assert"
	"testing"
)
func Test_NewInPort(t *testing.T) {
	assert := assert.New(t)
	var inPort = NewInPort(LocalInPortId)
	assert.NotNil(inPort, "FAILED: failed to create InPort")
	inPort = NewInPort(RemoteInPortId)
	assert.NotNil(inPort, "FAILED: failed to create InPort")
}
func TestInPort_Channel(t *testing.T) {
	assert := assert.New(t)
	var inPort = NewInPort(LocalInPortId)
	assert.NotNil(inPort, "FAILED: failed to create InPort")
	inputChannel := inPort.Channel()
	assert.NotNil(inputChannel, "FAILED: failed to get InPort channel")
}
func Test_Read(t *testing.T) {
	assert := assert.New(t)
	var inPort = NewInPort(LocalInPortId)
	assert.NotNil(inPort, "FAILED: failed to create InPort")
	txMsg := &types.Transaction{}
	go func() {
		inPort.Channel() <- txMsg
	}()
	recvMsg := <-inPort.Read()
	assert.Equal(recvMsg, txMsg, "FAILED: failed to Read the message")
}
func Test_NewOutPort(t *testing.T) {
	assert := assert.New(t)
	var outPort = NewOutPort(LocalOutPortId)
	assert.NotNil(outPort, "FAILED: failed to create OutPort")
	outPort = NewOutPort(RemoteOutPortId)
	assert.NotNil(outPort, "FAILED: failed to create OutPort")
}