public void CanLoadContacts() { var repo = new AccountRepositoryADO(); var Type = repo.GetContact(1); Assert.AreEqual("Bill", Type.Name); }
public void CanDetectContact() { var repo = new AccountRepositoryADO(); var found = repo.IsContact("11111111-1111-1111-1111-111111111111", 1); Assert.IsTrue(found); found = repo.IsContact("11111111-1111-1111-1111-111111111111", 99); Assert.IsFalse(found); }
public void CanDetectFavorite() { var repo = new AccountRepositoryADO(); var found = repo.IsFavorite("11111111-1111-1111-1111-111111111111", 2); Assert.IsTrue(found); found = repo.IsFavorite("11111111-1111-1111-1111-111111111111", 99); Assert.IsFalse(found); }
public void CanAddAndRemoveContacts() { var repo = new AccountRepositoryADO(); repo.AddContact("11111111-1111-1111-1111-111111111111", 5); var contacts = repo.GetContacts(Guid.Empty.ToString()); Assert.AreEqual(3, contacts.Count()); repo.RemoveContact("11111111-1111-1111-1111-111111111111", 3); contacts = repo.GetContacts(Guid.Empty.ToString()); Assert.AreEqual(2, contacts.Count()); }
public void CanAddAndRemoveFavorites() { var repo = new AccountRepositoryADO(); repo.AddFavorite("11111111-1111-1111-1111-111111111111", 3); var favorites = repo.GetFavorites("11111111-1111-1111-1111-111111111111"); Assert.AreEqual(3, favorites.Count()); repo.RemoveFavorite("11111111-1111-1111-1111-111111111111", 2); favorites = repo.GetFavorites("11111111-1111-1111-1111-111111111111"); Assert.AreEqual(2, favorites.Count()); }
public void CanLoadContacts() { var repo = new AccountRepositoryADO(); var contacts = repo.GetContacts(Guid.Empty.ToString()).ToList(); Assert.AreEqual(2, contacts.Count()); Assert.AreEqual(1, contacts[0].ListingId); Assert.AreEqual("11111111-1111-1111-1111-111111111111", contacts[0].UserId); Assert.AreEqual("Test shack 1", contacts[0].Nickname); Assert.AreEqual("OH", contacts[0].StateId); Assert.AreEqual("Cleveland", contacts[0].City); Assert.AreEqual(100M, contacts[0].Rate); Assert.AreEqual("*****@*****.**", contacts[0].Email); }
public IHttpActionResult CheckContact(string userId, int listingId) { var repo = new AccountRepositoryADO(); try { var result = repo.IsContact(userId, listingId); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult AddContact(Contact contact, int InventoryNumber) { var repo = new AccountRepositoryADO(); //try //{ repo.InsertContactSelect(contact, InventoryNumber); return(Ok()); //} //catch (Exception ex) //{ // return BadRequest(ex.Message); //} }
public IHttpActionResult AddContact(Contact contact) { var repo = new AccountRepositoryADO(); try { repo.InsertContact(contact); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult AddContact(Contact contact, string userId, int InventoryNumber) { var repo = new AccountRepositoryADO(); try { repo.InsertContactDirect(userId, InventoryNumber); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void CanLoadFavorites() { var repo = new AccountRepositoryADO(); var favorites = repo.GetFavorites("11111111-1111-1111-1111-111111111111").ToList(); Assert.AreEqual(2, favorites.Count()); Assert.AreEqual(1, favorites[0].ListingId); Assert.AreEqual("00000000-0000-0000-0000-000000000000", favorites[0].UserId); Assert.AreEqual("OH", favorites[0].StateId); Assert.AreEqual("Cleveland", favorites[0].City); Assert.AreEqual(100M, favorites[0].Rate); Assert.AreEqual(400M, favorites[0].SquareFootage); Assert.AreEqual(false, favorites[0].HasElectric); Assert.AreEqual(true, favorites[0].HasHeat); Assert.AreEqual(1, favorites[0].BathroomTypeId); Assert.AreEqual("Indoor", favorites[0].BathroomTypeName); }
public void CanInsertContacts() { var repo = new AccountRepositoryADO(); var contact = new Contact(); contact.Name = "Test"; contact.Phone = "1234567890"; contact.Message = "Testing"; contact.Email = "Test"; repo.InsertContact(contact); var Type = repo.GetContact(3); Assert.AreEqual("Test", Type.Name); Assert.AreEqual("Test", Type.Email); Assert.AreEqual("Testing", Type.Message); Assert.AreEqual("1234567890", Type.Phone); }
public void CanLoadListingsForUser() { var repo = new AccountRepositoryADO(); var listings = repo.GetListings("00000000-0000-0000-0000-000000000000").ToList(); Assert.AreEqual(6, listings.Count()); Assert.AreEqual(1, listings[0].ListingId); Assert.AreEqual("OH", listings[0].StateId); Assert.AreEqual(3, listings[0].BathroomTypeId); Assert.AreEqual("Test shack 1", listings[0].Nickname); Assert.AreEqual("Cleveland", listings[0].City); Assert.AreEqual(100M, listings[0].Rate); Assert.AreEqual(400M, listings[0].SquareFootage); Assert.AreEqual(false, listings[0].HasElectric); Assert.AreEqual(true, listings[0].HasHeat); Assert.AreEqual("placeholder.png", listings[0].ImageFileName); Assert.AreEqual("None", listings[0].BathroomTypeName); }
public IHttpActionResult AddContact(string Name, string Email, string Phone, string Message) { var repo = new AccountRepositoryADO(); Contact contact = new Contact(); contact.Email = Email; contact.Message = Message; contact.Name = Name; contact.Phone = Phone; try { repo.InsertContact(contact); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void CanDeleteContact() { var repo = new AccountRepositoryADO(); var contact = new Contact(); contact.Name = "Test"; contact.Phone = "1234567890"; contact.Message = "Testing"; contact.Email = "Test"; repo.InsertContact(contact); var load = repo.GetContact(3); Assert.IsNotNull(load.Name); repo.DeleteContact(3); load = repo.GetContact(3); Assert.IsNull(load.Name); }