public void CreateTest172() { CoreFactory coreFactory; byte[] bs; coreFactory = new CoreFactory(); bs = this.CreateTest(coreFactory, "ꁵ韞", (string)null, 0); Assert.IsNotNull((object)coreFactory); }
public void CreateTest158() { CoreFactory coreFactory; byte[] bs; coreFactory = new CoreFactory(); bs = this.CreateTest(coreFactory, "AL", "AL", 0); Assert.IsNotNull((object)coreFactory); }
internal void CreateTest01() { string dataType=null, dataBlock=null; int specialCode = 0; byte[] resultBytes; byte[] compareBytes; string result; string compare; CoreFactory target = new CoreFactory(); SerialProtocolOld serialProtocolOld = new SerialProtocolOld(); //dataType=null dataType = null; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); #region 功能测试 //A0-0 dataType = "A0"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftGeneralStatus(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A0-65 专用码测试 dataType = "A0"; specialCode = 65; serialProtocolOld.SpecialCode = 65; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftGeneralStatus(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); dataType = "A0"; specialCode = 255; serialProtocolOld.SpecialCode = 255; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftGeneralStatus(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); dataType = "A0"; specialCode = 1000; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A1 - 数据块正常 dataType = "A1"; dataBlock = "1"; serialProtocolOld.SpecialCode = 0; specialCode = 0; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftFaultHsitory(1); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A1 - 数据块异常 dataType = "A1"; dataBlock = "240"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "800"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "24XS"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A3 - 数据块正常 dataType = "A3"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftCall(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A3 - 数据块异常 dataType = "A3"; dataBlock = "10"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A4 - 数据块正常 dataType = "A4"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftInOutPut(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A4 - 数据块异常 dataType = "A4"; dataBlock = "10"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A5 - 数据块正常 dataType = "A5"; dataBlock = "100"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftPara(100); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A5 - 数据块异常 dataType = "A5"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A6 - 数据块正常 dataType = "A6"; dataBlock = "48"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftWellData(48); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A6 - 数据块异常 dataType = "A6"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A7 - 数据块正常 dataType = "A7"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftRunTimes(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A7 - 数据块异常 dataType = "A7"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A8 - 数据块正常 dataType = "A8"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftSpeed(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A8 - 数据块异常 dataType = "A8"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //A9 - 数据块正常 dataType = "A9"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftDate(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //A9 - 数据块异常 dataType = "A9"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //AB - 数据块正常 dataType = "AB"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftProgram(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //AB - 数据块异常 dataType = "AB"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //AK - 数据块正常 dataType = "AK"; dataBlock = "30"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftLevelTrim(30); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //Ak - 数据块异常 dataType = "AK"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //AL - 数据块正常 dataType = "AL"; dataBlock = "30"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftFloorDisp(30); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //AL - 数据块异常 dataType = "AL"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //AX - 数据块正常 dataType = "AX"; dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.InquiryLiftLoginLevel(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //AL - 数据块异常 dataType = "AX"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //F3 - 数据块正常 dataType = "F3"; dataBlock = "0 5"; //指令 resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.WriteLiftOrder(5); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //指令 - 数据块异常 dataType = "F3"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "0 80"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "5 10"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //上召 dataBlock = "1 15"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.WriteLiftUpCall(15); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //下召 dataBlock = "2 45"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.WriteLiftDownCall(45); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //F4 - 数据块正常 dataType = "F4"; dataBlock = "0"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.LiftSelfLearn0(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); dataBlock = "F"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.LiftSelfLearnF(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //F4 - 数据块异常 dataType = "F4"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "2 455"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "2 4S5"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //F5 - 数据块正常 dataType = "F5"; dataBlock = "11 48"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.SetLiftPara(11, 48); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //F5 - 数据块异常 dataType = "F5"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "11 688888"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "11 SX"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //FA dataType = "FA"; dataBlock = "14 9 30"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.SetLiftDate(14, 9, 30); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); dataBlock = "14 8 31"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.SetLiftDate(14, 8, 31); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); dataBlock = "14 2 28"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.SetLiftDate(14, 2, 28); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //FA - 数据块异常 dataType = "FA"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "15 2 30"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "15 4 31"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "15 5 32"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //FB dataType = "FB"; dataBlock = "11 29 39"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.SetLiftTime(11, 29, 39); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //FB - 数据块异常 dataType = "FB"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "25 30 31"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "1 61 31"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "2 30 65"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "2 30 2000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //FR-0 dataType = "FR"; dataBlock = "0"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.ResetLiftParaRecords(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //FR - 数据块异常 dataType = "FR"; dataBlock = "1000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //FR-1 dataBlock = "1"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.ResetLiftParaRunTimes(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //FR-2 dataBlock = "2"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.ResetLiftParaFaultRecords(); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //C0 dataType = "C0"; dataBlock = "19163"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.LiftLogOut(19163); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //C0 - 数据块异常 dataType = "C0"; dataBlock = "100000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); //C1 dataType = "C1"; dataBlock = "19163"; resultBytes = target.Create(dataType, dataBlock, specialCode); compareBytes = serialProtocolOld.LiftLogin(19163); result = Encoding.Default.GetString(resultBytes); compare = Encoding.Default.GetString(compareBytes); Assert.IsTrue(result.Equals(compare)); //C1 - 数据块异常 dataType = "C1"; dataBlock = "100000"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = "xxx"; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); dataBlock = null; resultBytes = target.Create(dataType, dataBlock, specialCode); Assert.IsNull(resultBytes); #endregion }
internal CoreFactory ConstructorTest() { CoreFactory target = new CoreFactory(); return target; }
public void CreateTestThrowsIndexOutOfRangeException987() { CoreFactory coreFactory; byte[] bs; coreFactory = new CoreFactory(); bs = this.CreateTest(coreFactory, "", (string)null, 0); }