package cmput301w16t08.scaling_pancake;

import android.test.ActivityInstrumentationTestCase2;

public class BidTest extends ActivityInstrumentationTestCase2 {
    public BidTest() {
        super(Bid.class);
    }

    public void testGetInstrument() {
        User owner = new User("Owner", "Owner email");
        User bidder = new User("Bidder", "Bidder email");
        Instrument instrument = new Instrument(owner, "Description");
        Bid bid = new Bid(instrument, owner, bidder, 1.00f);
        Instrument returnedInstrument = bid.getInstrument();
        assertEquals(returnedInstrument.getOwner, instrument.getOwner);
        assertEquals(returnedInstrument.getDescription, instrument.getDescription);
    }

    public void testGetOwner() {
        User owner = new User("Owner", "Owner email");
        User bidder = new User("Bidder", "Bidder email");
        Instrument instrument = new Instrument(owner, "Description");
        Bid bid = new Bid(instrument, owner, bidder, 1.00f);
        User returnedOwner = bid.getOwner();
        assertEquals(returnedOwner.getName(), owner.getName());
        assertEquals(returnedOwner.getEmail(), owner.getEmail());
    }

    public void testGetBidder() {
        User owner = new User("Owner", "Owner email");
        User bidder = new User("Bidder", "Bidder email");
        Instrument instrument = new Instrument(owner, "Description");
        Bid bid = new Bid(instrument, owner, bidder, 1.00f);
        User returnedBidder = bid.getBidder();
        assertEquals(returnedBidder.getName(), bidder.getName());
        assertEquals(returnedBidder.getEmail(), bidder.getEmail());
    }

    public void testGetBidAmount() {
        User owner = new User("Owner", "Owner email");
        User bidder = new User("Bidder", "Bidder email");
        Instrument instrument = new Instrument(owner, "Description");
        Bid bid = new Bid(instrument, owner, bidder, 1.00f);
        assertEquals(bid.getBidAmount(), 1.00f);
    }

    public void testGetAccepted() {
        User owner = new User("Owner", "Owner email");
        User bidder = new User("Bidder", "Bidder email");
        Instrument instrument = new Instrument(owner, "Description");
        Bid bid = new Bid(instrument, owner, bidder, 1.00f);
        assertFalse(bid.getAccepted());
        bid.setAccepted();
        assertTrue(bid.getAccepted());
    }
}
@@ -2369,9 +2369,1381 @@
 ;%0A    %7D%0A
-%7D
+    %0A    // test use case 11: ViewCurrentBidsAsBorrower%0A    public void testViewCurrentBidsAsBorrower()%7B%0A %09// ViewCurrentBidsAsBorrower should return an ArrayList of Instruments%0A %0A    ArrayList%3CInstrument%3E result;%0A  %09Instrument ins1 = new Instrument(%E2%80%9Cowner1%E2%80%9D, %E2%80%9Cguitar,1%E2%80%9D);%0A  %09Instrument ins2 = new Instrument(%E2%80%9Cowner2%E2%80%9D, %E2%80%9Cguitar,2%E2%80%9D);%0A  %09ins1.setStatus(%E2%80%9Cbidded%E2%80%9D);%0A  %09ins2.setStatus(%E2%80%9Cbidded%E2%80%9D);%0A %0A  %09result = ViewCurrentBidsAsBorrower(%E2%80%9Cborrower1%E2%80%9D);%0A  %09assertEquals(result.size(),0);%0A %0A  %09BidOnInstrument(%E2%80%9Cborrower1%E2%80%9D,ins1,10);%0A  %09BidOnInstrument(%E2%80%9Cborrower2%E2%80%9D,ins2,10.5);%0A    result = ViewCurrentBidsAsBorrower(%E2%80%9Cborrower1%E2%80%9D);%0A    assertEquals(result.size(),2);%0A    assertTrue(result.contains(ins1));%0A    assertTrue(result.contains(ins2));%0A    %7D%0A    %0A    // test use case 12: ViewCurrentBidsAsOwner%0A    public testViewCurrentBidsAsOwner()%7B%0A    // ViewCurrentBidsAsOwner should return an ArrayList of Instruments%0A %0A    ArrayList%3CInstrument%3E result;%0A  %09Instrument ins1 = new Instrument(%E2%80%9Cowner1%E2%80%9D, %E2%80%9Cguitar,1%E2%80%9D);%0A  %09Instrument ins2 = new Instrument(%E2%80%9Cowner1%E2%80%9D, %E2%80%9Cguitar,2%E2%80%9D);%0A %0A    result = ViewCurrentBidsAsOwner(%E2%80%9Cowner1%E2%80%9D);%0A  %09assertEquals(result.size(),0);%0A %0A  %09ins1.setStatus(%E2%80%9Cbidded%E2%80%9D);%0A  %09ins2.setStatus(%E2%80%9Cbidded%E2%80%9D);%0A %0A  %09result = ViewCurrentBidsAsOwner(%E2%80%9Cowner1%E2%80%9D);%0A    assertEquals(result.size(),2);%0A    assertTrue(result.contains(ins1));%0A    assertTrue(result.contains(ins2));%0A    %7D%0A    %0A%7D%0A

add test for 11,12 use cases