Пример #1
0
        public void TestFindTransactionsDoesNotContainParametersShouldThrowException()
        {
            var restClientMock = new Mock <IRestClient>();
            var repository     = new RestIotaRepository(restClientMock.Object);

            repository.FindTransactions(new Dictionary <string, IEnumerable <TryteString> >());
        }
Пример #2
0
        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>() }
            });
        }
Пример #3
0
        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>() }
            });
        }
Пример #4
0
        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);
        }