public void TestInsertArt()
        {
            Console.Out.WriteLine("TestCreateArt called");
            Art aTemp = ctrArt.Insert("Hej123", "Dav", "Fin kunst", "asdasads", 450, 450);

            Assert.IsNotNull(aTemp, "Is not null");

            Assert.IsNotNull(aTemp.DateCreated, "Date is set");
            Assert.IsTrue(0 < aTemp.Name.Length, "Name is set");
            Assert.IsTrue(0 < aTemp.Artist.Length, "Artist is set");
            Assert.IsTrue(0 < aTemp.Description.Length, "Description is set");
            Assert.IsNotNull(aTemp.Image, "Image is not null");
            Assert.IsTrue(0 < aTemp.StartingBid, "Starting bid is set");
            Assert.IsTrue(0 < aTemp.PurchasePrice, "Purchaseprice is set");
            Assert.IsNull(aTemp.Bids, "Bids is null");
            ctrArt.DeleteArt(aTemp);
        }
Esempio n. 2
0
        public void TestUpdateAuction()
        {
            Auction auction = ctrAuction.RetriveById(27);

            Assert.IsNotNull(auction, "Auction is null");

            auction.Description = "Update test description";
            auction.Date        = DateTime.Now;
            var art = artCtr.Insert("Papir", "UCN", "Et fint papir", "", 10, 10);

            auction.Arts.Add(art);

            //var art2 = auction.Arts.Single(x => x.Id == 81);

            //auction.Arts.Remove(art2);


            ctrAuction.UpdateAuction(auction);
            //artCtr.DeleteArt(art);
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtName.Text != "")
     {
         if (grbCreate.Text == "Opret")
         {
             ctrArt.Insert(txtName.Text, txtArtist.Text, txtDescription.Text, txtImgUrl.Text, Convert.ToDecimal(txtStartPrice.Text), Convert.ToDecimal(txtPurchasePrice.Text));
         }
         else if (grbCreate.Text == "Rediger")
         {
             Art selectedArt = (Art)dgvAtrList.CurrentRow.DataBoundItem;
             int id          = selectedArt.Id;
             ctrArt.Update(id, txtName.Text, Convert.ToInt32(txtNumber.Text), txtArtist.Text, txtDescription.Text, txtImgUrl.Text, Convert.ToDecimal(txtStartPrice.Text), Convert.ToDecimal(txtPurchasePrice.Text));
         }
         loadArtPieces();
         clearTxtBoxes();
     }
     else
     {
         MessageBox.Show("Udfyld kunstværkets navn");
     }
 }