public async Task WebThreeState_ShouldAdd_FormDataObjectToSTate() { var formData = new PurchaseOrderData() { Approver = "I approve", Title = "NewTestFormTitle", DeliveryDate = DateTime.Now, Department = "DepartMentData", Item_Code = "ITem Code Data", Item_Discount = 42, Item_Name = "TEst ITem Name", Item_Price = "Item_Price data", Item_Qty = 42, Item_Total = 42, Notes = "Here are some notes", Requester = "The Request is success" }; string MutableDataTestString = "Mutable Data Test Words With a Full Model"; var SendFormInfo = new AddFormDataToStateAction() { FormObjectValues = formData, MutableDataString = MutableDataTestString }; WebThreeState SendFormDataResponse = await Mediator.Send(SendFormInfo); SendFormDataResponse.ImmutableObject.Title.ShouldBe("NewTestFormTitle"); SendFormDataResponse.MutableDataString.ShouldBe("Mutable Data Test Words With a Full Model"); WebThreeState ControlWebThreeState = Store.GetState <WebThreeState>(); ControlWebThreeState.ImmutableObject.Title.ShouldBe("NewTestFormTitle"); ControlWebThreeState.ImmutableObject.GetProperty("Approver").GetValue(ControlWebThreeState.ImmutableObject).ShouldBe("I approve"); ControlWebThreeState.ImmutableObject.GetProperty("Item_Total").GetValue(ControlWebThreeState.ImmutableObject).ShouldBe(42); //ImmutableObjectBase ControlImmutableObj = ControlWebThreeState.ImmutableObject; //ImmutableObjectBase TestedImmutableObj = SendFormDataResponse.ImmutableObject; //ControlWebThreeState.ImmutableObject.Title.ShouldBe("Mutable Data Test Words With a Full Model"); //System.Reflection.PropertyInfo[] Control_ImmutableObjectParams = ControlWebThreeState.ImmutableObject.GetType().GetProperties(); //foreach (System.Reflection.PropertyInfo prop in Control_ImmutableObjectParams) //{ // var testValue = //} //static object GetValue(System.Reflection.PropertyInfo PropName, object TargetObj) //{ // return PropName.GetValue(TargetObj); //} }
public async Task WebThreeState_Get_Form_Data() { var formData = new ImmutableObjectBase() { Title = "TestFormTitle" }; string MutableDataTestString = "Mutable Data Test Words"; var SendFormInfo = new AddFormDataToStateAction() { FormObjectValues = formData, MutableDataString = MutableDataTestString }; WebThreeState SendFormDataResponse = await Mediator.Send(SendFormInfo); SendFormDataResponse.ImmutableObject.Title.ShouldBe("TestFormTitle"); SendFormDataResponse.MutableDataString.ShouldBe("Mutable Data Test Words"); }