public void CategoriesTest()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(); // TODO: Initialize to an appropriate value
     SelectList expected = null; // TODO: Initialize to an appropriate value
     SelectList actual;
     target.Categories = expected;
     actual = target.Categories;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public ActionResult Create(ArtworkControllerModel model)
        {
            Artwork artwork = model.GetArtwork(db);

            if(ModelState.IsValid)
            {
                db.Artworks.Add(artwork);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(artwork);
        }
        public ActionResult Edit(ArtworkControllerModel model)
        {
            if(ModelState.IsValid)
            {
                Artwork artwork = model.GetArtwork(db);

                Artwork origArtwork = db.Artworks.First(x => x.ID == artwork.ID);

                //db.Entry(origArtwork).CurrentValues.SetValues(artwork);
                origArtwork.UpdateFrom(artwork);
                db.Entry(origArtwork).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(model);
        }
        public void Constructor_Null_QuantityIs1()
        {
            //ArtworkDBContext db = new ArtworkDBContext();
            //IDbSet<Category> category = MockRepository.GenerateStub<IDbSet<Category>>();
            //IDbSet<Style> style = MockRepository.GenerateStub<IDbSet<Style>>();

            //var category = MockRepository.GenerateStub<IDbSet<Category>>();

            //category.BackToRecord();
            //Expect.Call(category.ToList()).Return(new List<Category>());
            //category
            //	.Stub(x => x.ToList())
            //	.IgnoreArguments()
            //	.Return(new List<Category>());
            //category.Replay();

            //var style = MockRepository.GenerateStub<IDbSet<Style>>();
            //Expect.Call(style.ToList()).Return(new List<Style>());
            ////style.BackToRecord();
            //style
            //	.Stub(x => x.ToList())
            //	.WhenCalled(x => x.ReturnValue = new List<Style>())
            //	.Return(null);
            //style.Replay();

            //db.BackToRecord();

            //Expect.Call(db.Categories = category);
            //Expect.Call(db.Styles = style);

            ////db.Set();

            //db.Replay();
            //style.Create();
            //category.Create();

            //db.Stub(x => x.Categories).Return(category);
            //db.Stub(x => x.Styles).Return(style);

            //db.(x => x.Categories).Return(category);
            //db.Stub(x => x.Styles).Return(style);

            ArtworkControllerModel target = new ArtworkControllerModel();

            Assert.AreEqual(1, target.Quantity);
        }
 public void Constructor_Null_GiftTypesCountIs0()
 {
     ArtworkControllerModel target = new ArtworkControllerModel();
     Assert.AreEqual(0, target.GiftTypes.Count);
 }
 public void Constructor_Null_CategoriesCountIs0()
 {
     ArtworkControllerModel target = new ArtworkControllerModel();
     Assert.AreEqual(0, target.Categories.Count());
 }
 public void Constructor_EmptyDBContext_StylesCountIs0()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(new ArtworkDBContext());
     Assert.AreEqual(0, target.Styles.Count());
 }
        public void Constructor_EmptyDBContext_QuantityIs1()
        {
            ArtworkControllerModel target = new ArtworkControllerModel(new ArtworkDBContext());

            Assert.AreEqual(1, target.Quantity);
        }
 public void Constructor_CategoriesAdded_CategoriesCountIs5()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(new ArtworkDBContext());
     Assert.AreEqual(0, target.Categories.Count());
 }
 public void WidthTest()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(); // TODO: Initialize to an appropriate value
     int expected = 0; // TODO: Initialize to an appropriate value
     int actual;
     target.Width = expected;
     actual = target.Width;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void TitleTest()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     target.Title = expected;
     actual = target.Title;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void PriceTest()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(); // TODO: Initialize to an appropriate value
     Decimal expected = new Decimal(); // TODO: Initialize to an appropriate value
     Decimal actual;
     target.Price = expected;
     actual = target.Price;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void GetArtworkTest()
 {
     ArtworkControllerModel target = new ArtworkControllerModel(); // TODO: Initialize to an appropriate value
     ArtworkDBContext db = null; // TODO: Initialize to an appropriate value
     Artwork expected = null; // TODO: Initialize to an appropriate value
     Artwork actual;
     actual = target.GetArtwork(db);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void Constructor_StylesAdded_StylesCountIsCorrect()
        {
            ArtworkDBContext db = new ArtworkDBContext();

            ResourceSet styleTypes = LisaChowArtwork.Resources.Styles.ResourceManager.GetResourceSet(
                CultureInfo.CurrentUICulture,
                true,
                true);

            int maxCount = new Random().Next(1, 7);

            int counter = 0;
            foreach (DictionaryEntry styleTypeItem in styleTypes)
            {
                db.Styles.Add(new Style() { Type = styleTypeItem.Value.ToString() });
                db.SaveChanges();

                counter++;
                if (counter >= maxCount) break;
            }

            ArtworkControllerModel target = new ArtworkControllerModel(db);

            Assert.AreEqual(maxCount, target.Styles.Count());
            Assert.AreEqual(maxCount, db.Styles.Count());
            Assert.AreEqual(maxCount, db.Styles.Local.Count());
        }