/// <summary> /// 获取抵扣券、加息券列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="userID"></param> /// <returns></returns> public BasePage <List <OwnBonusEntity> > SelectOwnBonuses(int pageIndex, int pageSize, int userID) { BasePage <List <OwnBonusEntity> > result = null; result = _dal.SelectOwnBonuses(pageIndex, pageSize, userID); ActBase actBase = new ActBase(); string temp = string.Empty; if (result.rows != null && result.rows.Count > 0) { foreach (var item in result.rows) { if (item.UseLifeLoan == null) { item.UseLifeLoan = string.Empty; item.UseLifeLoanMessage = string.Empty; } actBase.GetCanUseLimit(item.UseLifeLoan, out temp); if (!string.IsNullOrWhiteSpace(temp)) { item.UseLifeLoanMessage = temp; } temp = string.Empty; } } return(result); }
public override void AfterAct(ActBase act) { var argumentException = (ArgumentException)act.Exception; base.AfterAct(act); // Exception was expected => No error anymore! act.Exception = null; if (argumentException.ParamName != _ExpectedParameterName) { throw new SmartTestException(string.Format(Resource.ThrowBadParameterName, _ExpectedParameterName, argumentException.ParamName)); } if (_ExpectedMessage != null && argumentException.Message.EndsWith(argumentException.ParamName) && ExpectedMessage() != _ExpectedMessage) { throw new SmartTestException(string.Format(Resource.ThrowBadMessage, _ExpectedMessage, ExpectedMessage())); } string ExpectedMessage() { var strings = argumentException.Message.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList(); strings.RemoveAt(strings.Count - 1); return(string.Join(Environment.NewLine, strings)); } }
public override void AfterAct(ActBase act) { if (act.Exception != null) { return; } if (_Event.WaitOne(_Timeout)) { // Everything is OK return; } if (!act.Context.TryGetValue(_ContextHandleSet, out bool handleSet)) { // Not a context handle throw new SmartTestException(Resource.TimeoutReached, _Timeout.TotalMilliseconds); } // context handle is set? => waiting for the wrong handle! if (handleSet) { throw SmartTest.InconclusiveException(Resource.BadTest_UnexpectedContextSetHandle); } throw new SmartTestException(Resource.TimeoutReached, _Timeout.TotalMilliseconds); }
public override void AfterAct(ActBase act) { if (act.Exception != null) { return; } var message = new StringBuilder(); foreach (var pair in _PropertyValues) { if (!Equals(_PropertyValues[pair.Key], pair.Key.GetValue(_Instance))) { message.AppendLine(); message.Append(string.Format(Resource.PropertyChanged, pair.Key.GetFullName())); } } foreach (var pair in _FieldValues) { if (!Equals(_FieldValues[pair.Key], pair.Key.GetValue(_Instance))) { message.AppendLine(); message.AppendFormat(Resource.FieldChanged, pair.Key.GetFullName()); } } if (message.Length > 0) { throw new SmartTestException(message.ToString(Environment.NewLine.Length, message.Length - Environment.NewLine.Length)); } }
public static XmlEvent LoadXml(XmlNode nodeEvent) { if (nodeEvent == null) { return(null); } XmlEvent newEvent = new XmlEvent(); newEvent.xmlText = Formater.FormatXML(nodeEvent.OuterXml); //////////////////////////////////////////////////////////////////////// XmlNodeList actList = nodeEvent.SelectNodes("action"); newEvent.eventID = ((XmlElement)nodeEvent).getString("id"); if (actList.Count > 0) { foreach (XmlElement nodeAct in actList) { string strAct = nodeAct.GetAttribute("cmdID"); if (string.IsNullOrEmpty(strAct)) { strAct = nodeAct.GetAttribute("cmd"); } ActBase newAct = ActBase.CreateAction(strAct); if (newAct != null) { newAct.loadXML(nodeAct); newEvent.actList.Add(newAct); } else { Debug.Log(nodeAct.OuterXml); } } return(newEvent); } actList = nodeEvent.ChildNodes; if (actList.Count > 0) { foreach (XmlElement nodeAct in actList) { ActBase newAct = ActBase.CreateAction(nodeAct.Name); if (newAct != null) { newAct.loadXML(nodeAct); newEvent.actList.Add(newAct); } else { Debug.Log(nodeAct.OuterXml); } } return(newEvent); } return(newEvent); }
public override void AfterAct(ActBase act) { if (_AfterFail) { throw new NotImplementedException(); } After++; }
public override void BeforeAct(ActBase act) { if (_BeforeFail) { throw new NotImplementedException(); } Before++; }
public override void AfterAct(ActBase act) { _Stopwatch.Stop(); if (_Stopwatch.ElapsedMilliseconds > _MaximumMilliseconds) { throw new SmartTestException(Resource.TimespanExceeded, _MaximumMilliseconds, _Stopwatch.ElapsedMilliseconds); } }
public override void AfterAct(ActBase act) { Assert.AreEqual(_Instance, act.Instance); Assert.AreEqual(_Constructor, act.Constructor); Assert.AreEqual(_Field, act.Field); Assert.AreEqual(_Method, act.Method); Assert.AreEqual(_Property, act.Property); }
public override void AfterAct(ActBase act) { var actualValue = _Assignee.AssigneeValue; if (!Equals(actualValue, _Value)) { throw new SmartTestException(string.Format(Resource.ChangeWrongly, _Value, actualValue)); } }
public override void BeforeAct(ActBase act) { if (_Event == null) { _Event = new AutoResetEvent(false); act.Context[_ContextHandle] = _Event; act.Context[_ContextHandleSet] = false; } }
public bool runAction(ActBase act) { if (act != null) { act.start(); return(act.isEnd); } return(true); }
private static void SaveAndCloseNewDocument(Word.Document document, ref ActBase act) { var tempFile = GetTemplateFileName(act); var tempPath = _resultsPath + tempFile; var newPath = Path.GetDirectoryName(tempPath) + Path.GetFileName(tempPath).Replace(Path.GetExtension(tempPath), "") + act.Id + Path.GetExtension(tempPath); document.SaveAs(newPath); document.Close(); act.DocumentBytes = File.ReadAllBytes(newPath); }
public void AddAction(ActBase act) { switch (act.actID) { case ACTION_ID.add_button: Pic2D._Button button2D = GetExec <Pic2D._Button>(); button2D.Init(act); button2D.enabled = true; break; } }
public static ActType GetActType(ActBase act) { return(act.ActType); var type = act.GetType(); if (type == typeof(ActInspection)) { return(ActType.АктОбследования); } if (type == typeof(ActInpectationFl)) { return(ActType.АктПроверкиФизЛица); } if (type == typeof(ActInspectationUlIp)) { return(ActType.АктПроверкиЮл); } if (type == typeof(AreaMeasurement)) { return(ActType.ОбмерПлощадиЗу); } if (type == typeof(AgreementStatement)) { return(ActType.ЗаявлениеСоглВнеплВыездПроверки); } if (type == typeof(CheckingJournal)) { return(ActType.ЖурналУчетаПроверокЮл); } if (type == typeof(CitizensCheckPlan)) { return(ActType.ПланПроверокГраждан); } if (type == typeof(OrderInspectionUlIp)) { return(ActType.аспоряжениеПроверкиЮл); } if (type == typeof(Protocol)) { return(ActType.ПротоколАдмПравонарушения); } if (type == typeof(Regulation)) { return(ActType.ПредписаниеУтсрНарушЗемЗакона); } if (type == typeof(PhotoTable)) { return(ActType.ФотоТаблица); } return(0); }
public void Init() { this.Acts = new List <ActBase>(); for (int i = 0; i < Data.Actions.Count; i++) { ActData data = Data.Actions[i]; ActBase act = ActFactory(data); if (act != null) { Acts.Add(act); } } }
public override void AfterAct(ActBase act) { var visitor = new ChangeVisitor(); visitor.Visit(_After.Body); var newValue = Expression.Lambda(visitor.Result).Compile().DynamicInvoke(); if (!Equals(newValue, _FutureValue)) { throw new SmartTestException(string.Format(Resource.ChangeWrongly, _FutureValue, newValue)); } }
public override void BeforeAct(ActBase act) { _Assignee = act as IAssignee; if (_Assignee == null) { throw SmartTest.InconclusiveException(Resource.BadTest_NotAssignment); } _Value = _Assignee.AssignedValue; if (Equals(_Assignee.AssigneeValue, _Value)) { throw SmartTest.InconclusiveException(Resource.BadTest_UnexpectedValue, _Value); } }
protected void Action(GameObject target) { param.self = gameObject; actions.ForEach(a => { ActBase act = ActBase.GetAction(a.type); if (act != null) { param.param = a.param; param.obj = (a.target == ActionTarget.SELF) ? gameObject : target; act.Action(param); } }); }
public override void BeforeAct(ActBase act) { _Assignee = act as IAssignee; if (_Assignee == null) { throw new BadTestException(Resource.BadTest_NotAssignment); } _Value = _Assignee.AssignedValue; if (Equals(_Assignee.AssigneeValue, _Value)) { throw new BadTestException(string.Format(Resource.BadTest_UnexpectedValue, _Value)); } }
protected void Action(WireControl wire, RaycastHit2D hit) { param.obj = hit.collider.gameObject; param.self = gameObject; actions.ForEach(a => { ActBase act = ActBase.GetAction(a.type); if (act != null) { param.param = a.param; act.Action(param); } }); }
public override void AfterAct(ActBase act) { _Event.RemoveEventHandler(_Instance, _RealDelegate); if (_Raised != _ExpectedRaised) { throw new SmartTestException(string.Format(_ExpectedRaised ? Resource.ExpectedRaisedEvent : Resource.ExpectedNotRaisedEvent, _Event.GetFullName() ) ); } }
private static string GetTemplateFileName(ActBase act) { var type = act.GetType(); if (type == typeof(ActInspection)) { return("ActInspection.docx"); } if (type == typeof(ActInpectationFl)) { return("ActInspectionFl.docx"); } if (type == typeof(ActInspectationUlIp)) { return("ActInspectionUlIp.rtf"); } if (type == typeof(AreaMeasurement)) { return("AreaMeasurement.docx"); } if (type == typeof(AgreementStatement)) { return("AgreementStatement.RTF"); } if (type == typeof(CheckingJournal)) { return("CheckingJournal.RTF"); } if (type == typeof(CitizensCheckPlan)) { return("CitizensCkeckingPlan.docx"); } if (type == typeof(OrderInspectionUlIp)) { return("OrderInspectionUlIp.rtf"); } if (type == typeof(Protocol)) { return("Protocol.docx"); } if (type == typeof(Regulation)) { return("Regulation.docx"); } if (type == typeof(PhotoTable)) { return("PhotoTable.docx"); } throw new NotImplementedException("Этот тип акта еще не поддерживается!"); }
public virtual void Init(ActBase a) { actPic = a as _show_pic; XmlPic2D xmlPic = XmlStage.GetAsset2D(actPic.assetID); if (xmlPic == null) { Debug.LogError("显示图片错误,找不到文件按 " + actPic.assetID + "in stage " + XmlStage.curStage.id); return; } xmlPic.InitSprite(); Sprite tex = xmlPic.PicNormal;// Resources.Load<Sprite>(XmlStage.filePath + btn.picNormal.fileName); InitPos(tex, actPic.pos, xmlPic.scale, actPic.angle); }
public override void BeforeAct(ActBase act) { if (_Instance == null) { _Instance = act.Instance; if (_IsImplicit) { if (act.Property == null) { throw SmartTest.InconclusiveException(Resource.BadTest_NotPropertyNorField, act.Member.Name, _Instance.GetType().GetFullName()); } _Exceptions = new[] { act.Property.Name }; } } var propertiesVisibility = (Visibility)(_Kind & NotChangedKind.AllProperties); var instanceType = _Instance.GetType(); _Properties = propertiesVisibility != 0 ? instanceType.GetProperties(propertiesVisibility) : new PropertyInfo[0]; var fieldsVisibility = (Visibility)((int)(_Kind & NotChangedKind.AllFields) >> 4); _Fields = fieldsVisibility != 0 ? instanceType.GetFields(fieldsVisibility) : new FieldInfo[0]; if (_Exceptions != null) { CheckExceptions(); _Properties = _Properties.Where(prop => !_Exceptions.Contains(prop.Name)).ToArray(); _Fields = _Fields.Where(field => !_Exceptions.Contains(field.Name)).ToArray(); } foreach (var property in _Properties) { if (property.CanRead && property.GetMethod.GetParameters().Length == 0) { _PropertyValues[property] = property.GetValue(_Instance); } } foreach (var field in _Fields) { _FieldValues[field] = field.GetValue(_Instance); } }
public static ActBase ActFactory(ActData data) { ActBase act = null; switch (data.Type) { case EActType.TYPE_ANIM: act = new ActAnim(); break; } if (act != null) { act.Data = data; } return(act); }
public override void AfterAct(ActBase act) { if (act.Exception == null) { throw new SmartTestException(string.Format(Resource.ThrowNoException, typeof(T).FullName)); } if (act.Exception.GetType() != typeof(T)) { act.Exception = new SmartTestException(string.Format(Resource.ThrowWrongException, typeof(T).FullName, act.Exception.GetType().FullName)); throw act.Exception; } var exception = (T)act.Exception; act.Exception = null; _Verify?.Invoke(exception); }
public override void AfterAct(ActBase act) { if (_Instance != null) { _Instance.PropertyChanged -= InstanceOnPropertyChanged; } if (_Raised != _ExpectedRaised) { throw new SmartTestException(string.Format(_ExpectedRaised ? Resource.ExpectedRaisedEvent : Resource.ExpectedNotRaisedEvent, "PropertyChanged" ) ); } }
public void Start() { curAction = 0; ActBase act = CurAction(); while (act != null) { if (runAction(act)) { act = NextAction(); } else { break; } } }
public override void Init(ActBase act) { actButton = act as _show_button; strEvent = actButton.strEvent; XmlPic2D xml = XmlStage.GetAsset2D(actButton.assetID); if (xml != null) { xml.InitSprite(); strEvent = actButton.strEvent; Sprite tex = xml.PicNormal; InitPos(tex, actButton.pos, xml.scale, 0); } }