public async Task Should_Fetch_NftTypes() { var fetchNftTypes = new GetNftTypesClientFeaturesAction(); WebThreeState response = await Mediator.Send(fetchNftTypes); response.TotalNftTypes.ShouldBeGreaterThan((uint)2); }
public void WebThreeState_Should_Exist() { webThreeState = Store.GetState <WebThreeState>(); webThreeState.ShouldNotBe(null); webThreeState.OwnedTokenIdList.Count.ShouldBe(0); }
public async Task ClientActionTest() { var Action = new GetNftTypesClientFeaturesAction(); WebThreeState ActionResponse = await Mediator.Send(Action); ActionResponse.ShouldNotBe(null); ActionResponse.TotalNftTypes.ShouldBeGreaterThan((uint)2); }
public async void SendDataToState() { ConsoleData(); WebThreeState response = await Mediator.Send(new AddFormDataToStateAction() { FormObjectValues = FormData, MutableDataString = MutableDataString }); }
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 ClientGetTokenNftType() { var aFetchTokenNftTypeAction = new FetchTokenNftTypeAction { TokenId = 3 }; WebThreeState aFetchTokenNftTypeResponse = await Mediator.Send(aFetchTokenNftTypeAction); aFetchTokenNftTypeResponse.CurrentTokenNftType.ShouldNotBe((uint)0); aFetchTokenNftTypeResponse.CurrentTokenNftType.ShouldBe((uint)4); }
public async Task ClientActionTest() { var aGetNftByTypeAction = new GetNftByTypeAction { GetNftType = 4 }; WebThreeState aGetNftByTypeResponse = await Mediator.Send(aGetNftByTypeAction); aGetNftByTypeResponse.ShouldNotBe(null); aGetNftByTypeResponse.CurrentNftTemplate.ShouldNotBe(null); aGetNftByTypeResponse.CurrentNftTemplate.Name.ShouldBeOfType <string>(); }
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"); }
public async Task Should_Generate_NftTypesListWithIds() { var NftTypeList = new List <NftTemplate>(); var fetchNftTypes = new GetNftTypesClientFeaturesAction(); WebThreeState response = await Mediator.Send(fetchNftTypes); int NumOfTemplates = (int)response.TotalNftTypes; // Nft templates are not zero indexed. for (uint ctr = 1; ctr <= NumOfTemplates; ctr++) { string requestUri = GetNftByTypeSharedRequest.RouteFactory((int)ctr); GetNftByTypeSharedResponse templateResponse = await HttpClient.GetJsonAsync <GetNftByTypeSharedResponse>(requestUri); templateResponse.NftTypeData.ShouldBeOfType <NftTemplate>(); var template = new NftTemplate() { NftId = ctr, Name = templateResponse.NftTypeData.Name, Symbol = templateResponse.NftTypeData.Symbol, MintLimit = templateResponse.NftTypeData.MintLimit, AttachedTokens = templateResponse.NftTypeData.AttachedTokens }; NftTypeList.Add(template); // NftTypeDict[ctr] = templateResponse; // } NftTypeList[3].NftId.ShouldBe((uint)4); //NftTypeList[3].Name.ShouldBe("TesterTemplate_0"); //NftTypeDict[4].Name.ShouldBe("TesterTemplate_0"); }
//List<NftTemplate> TemplateDataList => WebThreeState.TemplateDataList; public async Task ShouldBuildTokenList() { WebThreeState webThree = await Mediator.Send(new GetNftTypesClientFeaturesAction()); GetAllOwnedTokensSharedResponse aTokenList = await HttpClient.GetJsonAsync <GetAllOwnedTokensSharedResponse>(GetAllOwnedTokensSharedRequest.Route); aTokenList.TokenIdList.Count.ShouldBeGreaterThan(3); aTokenList.TokenIdList.Contains(3).ShouldBe(true); aTokenList.TokenIdList.Contains(4).ShouldBe(true); aTokenList.TokenIdList.Contains(5).ShouldBe(true); foreach (uint token in aTokenList.TokenIdList) { // TokenId var ownedToken = new TokenBase() { TokenId = token }; // TokenNFtTypeId string getNftTypeUri = GetTokenNftTypeSharedRequest.RouteFactory((int)token); WebThreeState NftTypeContainer = await Mediator.Send(new FetchTokenNftTypeAction() { TokenId = (int)ownedToken.TokenId }); // TokenNftTypeData Should already have the data in state so no need to make a service call NftTemplate nftType = webThree.TemplateDataList.Find(nft => nft.NftId == NftTypeContainer.CurrentTokenNftType); ownedToken.TemplateData = nftType; // Token Balance BalanceOfSharedResponse BalanceContainer = await HttpClient.GetJsonAsync <BalanceOfSharedResponse>(BalanceOfSharedRequest.RouteFactory((int)token)); ownedToken.Balance = BalanceContainer.Balance; // Token ImmutableData (Data) ownedToken.TemplateData.ShouldBeOfType <NftTemplate>(); ViewTokenDataSharedResponse DataString = await HttpClient.GetJsonAsync <ViewTokenDataSharedResponse>(ViewTokenDataSharedRequest.RouteFactory((int)token)); DataString.TokenDataString.ShouldNotBe(null); if (token == 3) { byte[] serializedImmutableData = Convert.FromBase64String(DataString.TokenDataString); // need to figure out a way to get the type occording to the nftId ImmutableData DeserializedObject = Serializer.Deserialize <ImmutableData>(serializedImmutableData, options); // options == 0 ownedToken.ImmDataObj = DeserializedObject; // Add to StateList TokenDataList.Add(ownedToken); } else { ownedToken.Data = DataString.TokenDataString; TokenDataList.Add(ownedToken); } } TokenDataList.Count.ShouldBe(3); }
public async Task ShouldReturnWebThreeState() { WebThreeState webThreeState = await Mediator.Send(new GetAllOwnedTokensAction()); webThreeState.ShouldNotBe(null); }