public void Insert_Single_Inserts_Seller() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); Seller expected = new Seller("TestSeller", "Test", "Test", "Test", 0, "Test", 0); sellerdml.Insert_Single(expected); Seller actual = GetSeller(); Assert.AreEqual(expected, actual); }
public void Select_Single_Returns_Single_Element_Matching_Name() { SellerDML sellerdml = new SellerDML(); ClearDatabase(); InsertTestData(); Seller expected = new Seller("TestSeller1", "TestMail1", "Test", "Test", 0123, "Test", 0123); Seller actual = sellerdml.Select_Single("name:TestSeller1"); Assert.AreEqual(expected, actual); }
public void Update_Single_Updates_Row_Matching_Id() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); InsertTestData(); Seller expected = new Seller(1, "UpdatedSeller", "TestMail1", "Test", "Test", 0123, "Test", 0123); sellerdml.Update_Single(expected); Seller actual = GetSellerById(1); Assert.AreEqual(expected, actual); }
public SellerPage() { InitializeComponent(); sellerDML = new SellerDML(); sellers = sellerDML.GetAll(); sellerListView.ItemsSource = sellers; // TODO: need a way to handle the bags connected to a seller. Most Likely, load them in with a hashmap/dictionary for easy access sellerBags = new Dictionary <int, List <Bag> >(); defaultSearchPlaceholder = "Søg..."; }
public void Select_Multiple_With_No_Conditions_Throws_ArgumentException() { SellerDML sellerdml = new SellerDML(); ArgumentException expected = null; try { sellerdml.Select_Multiple(""); } catch (ArgumentException e) { expected = e; } Assert.IsNotNull(expected); }
public void Insert_Single_Runs_Without_Errors() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); Seller seller = new Seller("TestSeller", "Test", "Test", "Test", 0, "Test", 0); try { sellerdml.Insert_Single(seller); Assert.IsTrue(true); } catch (Exception e) { Console.WriteLine(e); Assert.Fail(); } }
public void Delete_Single_Deletes_Single_Entry() { SellerDML sellerdml = new SellerDML(); ClearDatabase(); InsertTestData(); int expected = Count() - 1; Seller seller = new Seller(1, "TestSeller", "TestMail1", "Test", "Test", 0123, "Test", 0123); sellerdml.Delete_Single(seller); int actual = Count(); Assert.AreEqual(expected, actual); }
public void Delete_Single_Given_Seller_Without_Id_Throws_Error() { SellerDML sellerdml = new SellerDML(); Seller seller = new Seller("", "", "", "", 0, "", 0); ArgumentException expected = null; try { sellerdml.Delete_Single(seller); } catch (ArgumentException e) { expected = e; } Assert.IsNotNull(expected); }
public void Insert_Multiple_Inserts_Sellers() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); List <Seller> expected = new List <Seller>() { new Seller("TestSeller", "Test", "Test", "Test", 0, "Test", 0), new Seller("TestSeller1", "Test1", "Test", "Test", 0, "Test", 0), }; sellerdml.Insert_Multiple(expected); List <Seller> actual = GetMultipleSellers(); for (int i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public void Select_Multiple_Returns_Multiple_Elements_Matching_Name() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); InsertTestData(); List <Seller> expected = new List <Seller> { new Seller("TestSeller1", "TestMail1", "Test", "Test", 0123, "Test", 0123), new Seller("TestSeller2", "TestMail2", "Test", "Test", 0123, "Test", 0123), new Seller("TestSeller3", "TestMail3", "Test", "Test", 0123, "Test", 0123) }; List <Seller> actual = sellerdml.Select_Multiple("name:TestSeller"); // Do not know another way to compare list items for (int i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public void Delete_Multiple_Deletes_Multiple_Entries() { SellerDML sellerdml = new SellerDML(); ClearDatabase(); InsertTestData(); int expected = Count() - 2; List <Seller> sellers = new List <Seller> { new Seller(1, "TestSeller", "TestMail1", "Test", "Test", 0123, "Test", 0123), new Seller(2, "TestSeller", "TestMail1", "Test", "Test", 0123, "Test", 0123), }; sellerdml.Delete_Multiple(sellers); int actual = Count(); Assert.AreEqual(expected, actual); }
public void Delete_Multiple_Given_Sellers_Without_Id_Throws_Error() { SellerDML sellerdml = new SellerDML(); List <Seller> sellers = new List <Seller> { new Seller("", "", "", "", 0, "", 0), new Seller("", "", "", "", 0, "", 0), }; ArgumentException expected = null; try { sellerdml.Delete_Multiple(sellers); } catch (ArgumentException e) { expected = e; } Assert.IsNotNull(expected); }
public void Update_Multiple_Given_User_Without_Id_Throws_ArgumentException() { SellerDML sellerdml = new SellerDML(); ArgumentException expected = null; List <Seller> sellers = new List <Seller> { new Seller("TestSeller1", "TestMail1", "Test", "Test", 0123, "Test", 0123), new Seller("TestSeller2", "TestMail2", "Test", "Test", 0123, "Test", 0123), new Seller("TestSeller3", "TestMail3", "Test", "Test", 0123, "Test", 0123) }; try { sellerdml.Update_Multiple(sellers); } catch (ArgumentException e) { expected = e; } Assert.IsNotNull(expected); }
public void Insert_Multiple_Runs_Without_Errors() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); List <Seller> sellers = new List <Seller>() { new Seller("TestSeller", "Test", "Test", "Test", 0, "Test", 0), new Seller("TestSeller1", "Test1", "Test", "Test", 0, "Test", 0), }; try { sellerdml.Insert_Multiple(sellers); // Pass test if it runs without error Assert.IsTrue(true); } catch (Exception e) { Console.WriteLine(e); Assert.Fail(); } }
public void Update_Multiple_Updates_Row_Matching_Id() { ClearDatabase(); SellerDML sellerdml = new SellerDML(); InsertTestData(); List <Seller> expected = new List <Seller> { new Seller(1, "Updated1", "TestMail1", "Test", "Test", 0123, "Test", 0123), new Seller(2, "updated2", "TestMail2", "Test", "Test", 0123, "Test", 0123), new Seller(3, "updated3", "TestMail3", "Test", "Test", 0123, "Test", 0123) }; sellerdml.Update_Multiple(expected); List <Seller> actual = GetMultipleSellers(new List <int>() { 1, 2, 3 }); for (int i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }