public void TestFindTransactionsDoesNotContainParametersShouldThrowException() { var restClientMock = new Mock <IRestClient>(); var repository = new RestIotaRepository(restClientMock.Object); repository.FindTransactions(new Dictionary <string, IEnumerable <TryteString> >()); }
public void TestFindTransactionsParametersIncludeInvalidParameterNamesShouldThrowException() { var restClientMock = new Mock <IRestClient>(); var repository = new RestIotaRepository(restClientMock.Object); repository.FindTransactions( new Dictionary <string, IEnumerable <TryteString> > { { "invalid", new List <TryteString>() } }); }
public void TestFindTransactionsWithGivenParametersButSomeAreEmptyShouldThrowException() { var restClientMock = new Mock <IRestClient>(); var repository = new RestIotaRepository(restClientMock.Object); repository.FindTransactions( new Dictionary <string, IEnumerable <TryteString> > { { "bundles", new List <TryteString>() }, { "addresses", new List <TryteString>() }, { "tags", new List <TryteString>() }, { "approvees", new List <TryteString>() } }); }
public void TestFindTransactionsWithValidParametersShouldReturnHashes() { var restClientMock = new Mock <IRestClient>(); restClientMock.Setup(r => r.Execute <GetTransactionsResponse>(It.IsAny <IRestRequest>())).Returns( () => { var restResponse = new RestResponse <GetTransactionsResponse> { StatusCode = HttpStatusCode.OK, Data = new GetTransactionsResponse { Hashes = new List <string> { "EJEAOOZYSAWFPZQESYDHZCGYNSTWXUMVJOVDWUNZJXDGWCLUFGIMZRMGCAZGKNPLBRLGUNYWKLJTYEAQX" } } }; return(restResponse); }); var repository = new RestIotaRepository(restClientMock.Object); var transactions = repository.FindTransactions( new Dictionary <string, IEnumerable <TryteString> > { { "bundles", new List <TryteString> { new TryteString( "RBTC9D9DCDEAUCFDCDADEAMBHAFAHKAJDHAODHADHDAD9KAHAJDADHJSGDJHSDGSDPODHAUDUAHDJAHAB") } }, { "addresses", new List <TryteString> { new TryteString( "RBTC9D9DCDEAUCFDCDADEAMBHAFAHKAJDHAODHADHDAD9KAHAJDADHJSGDJHSDGSDPODHAUDUAHDJAHAB") } }, { "tags", new List <TryteString> { new TryteString( "RBTC9D9DCDEAUCFDCDADEAMBHAFAHKAJDHAODHADHDAD9KAHAJDADHJSGDJHSDGSDPODHAUDUAHDJAHAB") } }, { "approvees", new List <TryteString> { new TryteString( "RBTC9D9DCDEAUCFDCDADEAMBHAFAHKAJDHAODHADHDAD9KAHAJDADHJSGDJHSDGSDPODHAUDUAHDJAHAB") } } }); Assert.AreEqual("EJEAOOZYSAWFPZQESYDHZCGYNSTWXUMVJOVDWUNZJXDGWCLUFGIMZRMGCAZGKNPLBRLGUNYWKLJTYEAQX", transactions.Hashes[0].Value); }