private static void AssertTradeData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is TradeEffectResponse); var effect = (TradeEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.Seller.AccountId, "GCVHDLN6EHZBYW2M3BQIY32C23E4GPIRZZDBNF2Q73DAZ5VJDRGSMYRB"); Assert.AreEqual(effect.OfferId, 1); Assert.AreEqual(effect.SoldAmount, "1000.0"); Assert.AreEqual(effect.SoldAsset, Asset.CreateNonNativeAsset("EUR", KeyPair.FromAccountId("GCWVFBJ24754I5GXG4JOEB72GJCL3MKWC7VAEYWKGQHPVH3ENPNBSKWS"))); Assert.AreEqual(effect.BoughtAmount, "60.0"); Assert.AreEqual(effect.BoughtAsset, Asset.CreateNonNativeAsset("TESTTEST", KeyPair.FromAccountId("GAHXPUDP3AK6F2QQM4FIRBGPNGKLRDDSTQCVKEXXKKRHJZUUQ23D5BU7"))); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/33788507721730"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=33788507721730-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=33788507721730-2"); }
private static void AssertOfferUpdatedData(EffectResponse instance) { Assert.IsTrue(instance is OfferUpdatedEffectResponse); var effect = (OfferUpdatedEffectResponse)instance; Assert.AreEqual("GDPFGP4IPE5DXG6XRXC4ZBUI43PAGRQ5VVNJ3LJTBXDBZ4ITO6HBHNSF", effect.Account.AccountId); Assert.AreEqual(DateTimeOffset.Parse("2018-06-06T10:23:57Z").UtcDateTime, effect.CreatedAt); }
private static void AssertSequenceBumpedData(EffectResponse instance) { Assert.IsTrue(instance is SequenceBumpedEffectResponse); var effect = (SequenceBumpedEffectResponse)instance; Assert.AreEqual("GDPFGP4IPE5DXG6XRXC4ZBUI43PAGRQ5VVNJ3LJTBXDBZ4ITO6HBHNSF", effect.Account); Assert.AreEqual(DateTimeOffset.Parse("2018-06-06T10:23:57Z").UtcDateTime, effect.CreatedAt); Assert.AreEqual(79473726952833048L, effect.NewSequence); }
private static void AssertDataUpdatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is DataUpdatedEffectResponse); var effect = (DataUpdatedEffectResponse)instance; Assert.AreEqual("GDPFGP4IPE5DXG6XRXC4ZBUI43PAGRQ5VVNJ3LJTBXDBZ4ITO6HBHNSF", effect.Account.AccountId); Assert.AreEqual(DateTimeOffset.Parse("2018-06-06T10:23:57Z").UtcDateTime, effect.CreatedAt); }
private static void LogResult(string label, EffectResponse result) { if (result == null) { Debug.LogError(string.Format("{0} Result was null!", label)); } else { Debug.Log(string.Format("{0} {1}", label, result)); } }
public static void AssertAccountCreatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is AccountCreatedEffectResponse); var effect = (AccountCreatedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GCBQ6JRBPF3SXQBQ6SO5MRBE7WVV4UCHYOSHQGXSZNPZLFRYVYOWBZRQ"); Assert.AreEqual(effect.StartingBalance, "30.0"); Assert.AreEqual(effect.PagingToken, "65571265847297-1"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/65571265847297"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=65571265847297-1"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=65571265847297-1"); }
private static void AssertAccountHomeDomainUpdatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is AccountHomeDomainUpdatedEffectResponse); var effect = (AccountHomeDomainUpdatedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.HomeDomain, "stellar.org"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/18970870550529"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=18970870550529-1"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=18970870550529-1"); }
public async Task GetEffect_CallEffectService() { var expectedEffectResponse = new EffectResponse(); var effect = new Effect { Id = 42 }; _effectService.GetEffectAsync(42) .Returns(effect); _mapper.Map <EffectResponse>(effect) .Returns(expectedEffectResponse); var result = await _effectsController.GetEffectAsync(42); result.Value.Should().Be(expectedEffectResponse); }
private static void AssertAccountDebitedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is AccountDebitedEffectResponse); var effect = (AccountDebitedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H"); Assert.AreEqual(effect.Asset, new AssetTypeNative()); Assert.AreEqual(effect.Amount, "30.0"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/65571265843201"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=65571265843201-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=65571265843201-2"); }
private static void AssertTrustlineUpdatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is TrustlineUpdatedEffectResponse); var effect = (TrustlineUpdatedEffectResponse)instance; Assert.AreEqual(effect.Account, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.Asset, Asset.CreateNonNativeAsset("TESTTEST", "GAZN3PPIDQCSP5JD4ETQQQ2IU2RMFYQTAL4NNQZUGLLO2XJJJ3RDSDGA")); Assert.AreEqual(effect.Limit, "100.0"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/33788507721730"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=33788507721730-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=33788507721730-2"); }
private static void AssertSignerUpdatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is SignerUpdatedEffectResponse); var effect = (SignerUpdatedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.Weight, 2); Assert.AreEqual(effect.PublicKey, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/33788507721730"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=33788507721730-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=33788507721730-2"); }
private static void AssertSignerRemoveData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is SignerRemovedEffectResponse); var effect = (SignerRemovedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GCFKT6BN2FEASCEVDNHEC4LLFT2KLUUPEMKM4OJPEJ65H2AEZ7IH4RV6"); Assert.AreEqual(effect.Weight, 0); Assert.AreEqual(effect.PublicKey, "GCFKT6BN2FEASCEVDNHEC4LLFT2KLUUPEMKM4OJPEJ65H2AEZ7IH4RV6"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/43658342567940"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=43658342567940-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=43658342567940-2"); }
private static void AssertSignerCreatedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is SignerCreatedEffectResponse); var effect = (SignerCreatedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GB24LPGAHYTWRYOXIDKXLI55SBRWW42T3TZKDAAW3BOJX4ADVIATFTLU"); Assert.AreEqual(effect.Weight, 1); Assert.AreEqual(effect.PublicKey, "GB24LPGAHYTWRYOXIDKXLI55SBRWW42T3TZKDAAW3BOJX4ADVIATFTLU"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/65571265859585"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=65571265859585-3"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=65571265859585-3"); }
private static void AssertAccountCreditedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is AccountCreditedEffectResponse); var effect = (AccountCreditedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GDLGTRIBFH24364GPWPUS45GUFC2GU4ARPGWTXVCPLGTUHX3IOS3ON47"); Assert.AreEqual(effect.Asset, new AssetTypeNative()); Assert.AreEqual(effect.Amount, "1000.0"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/13563506724865"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=13563506724865-1"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=13563506724865-1"); }
private static void AssertTrustlineDeauthorizedData(EffectResponse instance) { //There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element... Assert.IsTrue(instance is TrustlineDeauthorizedEffectResponse); var effect = (TrustlineDeauthorizedEffectResponse)instance; Assert.AreEqual(effect.Account.AccountId, "GA6U5X6WOPNKKDKQULBR7IDHDBAQKOWPHYEC7WSXHZBFEYFD3XVZAKOO"); Assert.AreEqual(effect.AssetType, "credit_alphanum4"); Assert.AreEqual(effect.AssetCode, "EUR"); Assert.AreEqual(effect.Trustor.AccountId, "GB3E4AB4VWXJDUVN4Z3CPBU5HTMWVEQXONZYVDFMHQD6333KHCOL3UBR"); Assert.AreEqual(effect.Links.Operation.Href, "http://horizon-testnet.stellar.org/operations/33788507721730"); Assert.AreEqual(effect.Links.Succeeds.Href, "http://horizon-testnet.stellar.org/effects?order=desc&cursor=33788507721730-2"); Assert.AreEqual(effect.Links.Precedes.Href, "http://horizon-testnet.stellar.org/effects?order=asc&cursor=33788507721730-2"); }
public async Task PutEditEffect_CallEffectService() { var editEffectRequest = new EditEffectRequest(); var expectedEffectResponse = new EffectResponse(); var effect = new Effect { Id = 42 }; _effectService.EditEffectAsync(_executionContext, 42, editEffectRequest) .Returns(effect); _mapper.Map <EffectResponse>(effect) .Returns(expectedEffectResponse); var result = await _effectsController.PutEditEffectAsync(_executionContext, 42, editEffectRequest); result.Value.Should().Be(expectedEffectResponse); await _effectService.Received(1) .EditEffectAsync(_executionContext, 42, editEffectRequest); }
public async Task PostCreateEffect_CallEffectService() { const int subCategoryId = 12; var createEffectRequest = new CreateEffectRequest(); var expectedEffectResponse = new EffectResponse(); var effect = new Effect { Id = 42 }; _effectService.CreateEffectAsync(_executionContext, subCategoryId, createEffectRequest) .Returns(effect); _mapper.Map <EffectResponse>(effect) .Returns(expectedEffectResponse); var result = await _effectSubCategoriesController.PostCreateEffectAsync(_executionContext, subCategoryId, createEffectRequest); result.StatusCode.Should().Be(201); result.Value.Should().Be(expectedEffectResponse); }