コード例 #1
0
        public static void TestClientRequestMsg_GetHeaderSummary_TypeSTORED_ASSET_IDS_GET_ContainsSTORED_ASSET_IDS_GET()
        {
            var msg = new ClientRequestMsg();

            var data = new byte[REQUEST_TYPE_LOC + 1];

            data[REQUEST_TYPE_LOC] = (byte)RequestType.STORED_ASSET_IDS_GET;
            msg.AddRange(data);

            Assert.That(msg.GetHeaderSummary(), Contains.Substring("STORED_ASSET_IDS_GET"));
        }
コード例 #2
0
        public static void TestClientRequestMsg_GetHeaderSummary_TypeTEST_DoesntThrow()
        {
            var msg = new ClientRequestMsg();

            var data = new byte[REQUEST_TYPE_LOC + 1];

            data[REQUEST_TYPE_LOC] = (byte)RequestType.TEST;
            msg.AddRange(data);

            Assert.DoesNotThrow(() => msg.GetHeaderSummary());
        }
コード例 #3
0
        public static void TestClientRequestMsg_GetHeaderSummary_TypeAndUUID_DoesntThrow()
        {
            var msg = new ClientRequestMsg();

            var data = new byte[REQUEST_TYPE_LOC + UUID_TAG_LOCATION + UUID_LEN];

            data[REQUEST_TYPE_LOC] = (byte)RequestType.TEST;
            Buffer.BlockCopy(Encoding.ASCII.GetBytes(Guid.NewGuid().ToString("N")), 0, data, UUID_TAG_LOCATION, UUID_LEN);
            msg.AddRange(data);

            Assert.DoesNotThrow(() => msg.GetHeaderSummary());
        }
コード例 #4
0
        public static void TestClientRequestMsg_GetHeaderSummary_TypeAndUUID_ContainsUUID()
        {
            var msg = new ClientRequestMsg();

            var assetId = Guid.NewGuid();

            var data = new byte[REQUEST_TYPE_LOC + UUID_TAG_LOCATION + UUID_LEN];

            data[REQUEST_TYPE_LOC] = (byte)RequestType.TEST;
            Buffer.BlockCopy(Encoding.ASCII.GetBytes(assetId.ToString("N")), 0, data, UUID_TAG_LOCATION, UUID_LEN);
            msg.AddRange(data);

            Assert.That(msg.GetHeaderSummary(), Contains.Substring(assetId.ToString("D")));
        }
コード例 #5
0
        public static void TestClientRequestMsg_GetHeaderSummary_TypeAndUUIDAndDataLength123_Contains123()
        {
            var msg = new ClientRequestMsg();

            var data = new byte[HEADER_SIZE + 123];

            data[REQUEST_TYPE_LOC] = (byte)RequestType.TEST;
            Buffer.BlockCopy(Encoding.ASCII.GetBytes(Guid.NewGuid().ToString("N")), 0, data, UUID_TAG_LOCATION, UUID_LEN);
            data[DATA_SIZE_MARKER_LOC]     = 0;
            data[DATA_SIZE_MARKER_LOC + 1] = 0;
            data[DATA_SIZE_MARKER_LOC + 2] = 0;
            data[DATA_SIZE_MARKER_LOC + 3] = 123;
            msg.AddRange(data);

            Assert.That(msg.GetHeaderSummary(), Contains.Substring("123"));
        }