// Path: src/main/java/com/github/ccob/bittrex4j/dao/OrderBook.java
// public enum TYPE {
//     buy, sell, both;
// }


import com.github.ccob.bittrex4j.dao.*;
import com.github.ccob.bittrex4j.dao.OrderBook.TYPE;
import com.github.signalr4j.client.hubs.*;
import com.google.gson.Gson;
import com.google.gson.internal.LinkedTreeMap;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.*;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Scanner;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
    @Test
    public void shouldReturnTicker() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/Ticker.json"));
        Response<Ticker> result = bittrexExchange.getTicker("ANY");

        assertThat(result.isSuccess(), is(true));
        assertEquals(0, new BigDecimal("0.0483").compareTo(result.getResult().getAsk()));
    }

    @Test
    public void shouldReturnMarketSummaries() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/MarketSummaries.json"));
        Response<MarketSummaryResult[]> result = bittrexExchange.getMarketSummaries();

        assertThat(result.isSuccess(), is(true));
        assertThat(result.getResult().length,equalTo(263));
    }

    @Test
    public void shouldReturnMarketSummary() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/MarketSummary.json"));
        Response<MarketSummary> result = bittrexExchange.getMarketSummary("ANY");

        assertThat(result.isSuccess(), is(true));
        assertThat(result.getResult().getMarketName(), equalTo("BTC-ETH"));
    }

    @Test
    public void shouldReturnOrderBook() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/OrderBook.json"));
// Path: src/main/java/com/github/ccob/bittrex4j/dao/OrderBook.java
// public enum TYPE {
//     buy, sell, both;
// }


// Path: src/test/java/com/github/ccob/bittrex4j/BittrexExchangeTest.java
import com.github.ccob.bittrex4j.dao.*;
import com.github.ccob.bittrex4j.dao.OrderBook.TYPE;
import com.github.signalr4j.client.hubs.*;
import com.google.gson.Gson;
import com.google.gson.internal.LinkedTreeMap;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.*;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Scanner;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

    @Test
    public void shouldReturnTicker() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/Ticker.json"));
        Response<Ticker> result = bittrexExchange.getTicker("ANY");

        assertThat(result.isSuccess(), is(true));
        assertEquals(0, new BigDecimal("0.0483").compareTo(result.getResult().getAsk()));
    }

    @Test
    public void shouldReturnMarketSummaries() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/MarketSummaries.json"));
        Response<MarketSummaryResult[]> result = bittrexExchange.getMarketSummaries();

        assertThat(result.isSuccess(), is(true));
        assertThat(result.getResult().length,equalTo(263));
    }

    @Test
    public void shouldReturnMarketSummary() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/MarketSummary.json"));
        Response<MarketSummary> result = bittrexExchange.getMarketSummary("ANY");

        assertThat(result.isSuccess(), is(true));
        assertThat(result.getResult().getMarketName(), equalTo("BTC-ETH"));
    }

    @Test
    public void shouldReturnOrderBook() throws IOException{
        setExpectationForJsonResultOnWebAPICall(loadTestResourceAsString("/OrderBook.json"));
        Response<OrderBook> result = (Response<OrderBook>) bittrexExchange.getOrderBook("ANY", TYPE.both);