public void Context()
        {
            _testPic1 = new Picture
            {
                Alt = "First Test Pic",
                OrdinalIndex = 0,
                ImageType = "jpg",
            };
            UnitOfWork.AddToSession(_testPic1);

            _testPic2 = new Picture
            {
                Alt = "Second Test Pic",
                OrdinalIndex = 0,
                ImageType = "jpg",
            };
            UnitOfWork.AddToSession(_testPic2);

            _testDessert1 = new Dessert
            {
                Name = "Test Dessert 1",
                Likes = 5,
                Dislikes = 2,
                Description = "A yummy tasty treat",
                Picture = _testPic1,
            };
            UnitOfWork.AddToSession(_testDessert1);

            _testDessert2 = new Dessert
            {
                Name = "Test Dessert 2",
                Likes = 10,
                Dislikes = 3,
                Description = "A yummy tasty treat",
                Picture = _testPic2,
            };
            UnitOfWork.AddToSession(_testDessert2);

            PersistenceManager.CommitCachedObjects();
        }
        public void Context()
        {
            _testPic1 = new Picture
                {
                    ID = new Guid("ca5e0210-16ac-4383-82a7-01efcc651f06"),
                    Alt = "First Test Pic",
                    OrdinalIndex = 0,
                    ImageType = "jpg",
                };

            _testPic2 = new Picture
                {
                    ID = new Guid("E06EB0EC-F107-431F-B79A-9548BA697B42"),
                    Alt = "Second Test Pic",
                    OrdinalIndex = 0,
                    ImageType = "jpg",
                };

            _testDessert1 = new Dessert
                            {
                                ID = new Guid("ca5e0210-16ac-4383-82a7-01efcc651f06"),
                                Picture = _testPic1,
                              	Name = "Test Dessert",
                                Likes = 5,
                                Dislikes = 2,
                              	Description = "A yummy tasty treat",
                            };

            _testDessert2 = new Dessert
                            {
                                ID = new Guid("E06EB0EC-F107-431F-B79A-9548BA697B42"),
                                Picture = _testPic2,
                              	Name = "Test Dessert",
                                Likes = 10,
                                Dislikes = 3,
                              	Description = "A yummy tasty treat",
                            };

            _pictureViewModel = new PictureViewModel
                                    {
                                        Alt = _testPic1.Alt,
                                        ImageType = _testPic1.ImageType,
                                        OrdinalIndex = _testPic1.OrdinalIndex,
                                        Url = "/Context/Photos/" + _testPic1.ID.ToString() + _testPic1.ImageType
                                    };

            _dessertViewModel = new DessertBoxViewModel
                                    {
                                        ID = _testDessert1.ID,
                                        Name = _testDessert1.Name,
                                        Description = _testDessert1.Description,
                                        Likes = _testDessert1.Likes,
                                        Dislikes = _testDessert1.Dislikes,
                                        Picture = _pictureViewModel
                                    };

            _unitOfWorkMock = new Mock<IUnitOfWork>();
            _unitOfWorkMock.Setup(uow => uow.GetAll<Dessert, int>(dessert => dessert.Likes >= 0
                , dessert => dessert.Likes
                , false))
                .Returns(new List<Dessert>() { _testDessert2, _testDessert1 });

            _dessertRepoMock = new Mock<IDessertRepository>();
            _dessertRepoMock.Setup(dr => dr.GetInOrder(dessert => dessert.Likes >= 0
                , dessert => dessert.Likes
                , false))
                .Returns(new List<Dessert>() { _testDessert2, _testDessert1 });

            _picServiceMock = new Mock<IPictureService>();
            _picServiceMock.Setup(ps => ps.GetFirstPictures(5))
                .Returns(new List<Picture>() { _testPic2, _testPic1 });

            _dessertServiceMock = new Mock<IDessertService>();
            _dessertServiceMock.Setup(ds => ds.GetRatedDesserts(false))
                .Returns(new List<Dessert>() { _testDessert2, _testDessert1 });

            _viewModelManagerMock = new Mock<IHomePageViewModelManager>();
            _viewModelManagerMock.Setup(hpvmm => hpvmm.Get())
                .Returns(new HomePageViewModel{ Desserts = new List<DessertBoxViewModel>{ _dessertViewModel }});
        }
        public void Context()
        {
            _testDessert = new Dessert
                               {
                                   ID = new Guid("ca5e0210-16ac-4383-82a7-01efcc651f06"),
                                   //TODO: Check to see if this needs validating
                                   //Picture = ,
                                   Name = "Test Dessert",
                                   Likes = 5,
                                   Dislikes = 2,
                                   Description = "A yummy tasty treat"
                               };

            _tempPictureViewModel = new TempPictureViewModel
                                        {
                                            Name = TEMP_PIC_FILE_NAME,
                                            SavedFIlePath = TEMP_PIC_FILE_PATH,
                                            ImageType = "jpg"
                                        };

            _testDessertViewModel = new DessertBoxViewModel
                                        {
                                            ID = new Guid("ca5e0210-16ac-4383-82a7-01efcc651f06"),
                                            //TODO: Check to see if this needs validating
                                            //Picture = ,
                                            Name = "Test Dessert",
                                            Likes = 5,
                                            Dislikes = 2,
                                            Description = "A yummy tasty treat"
                                        };

            _unitOfWorkMock = new Mock<IUnitOfWork>();
            _httpHelperMock = new Mock<IHttpHelper>();
            //TODO: Add test for when TempPictureViewModel already exists in session.
            _httpHelperMock.Setup(helper => helper.GetFromAppSession<TempPictureViewModel>(TEMP_PIC_SESSION_KEY))
                .Returns(_tempPictureViewModel);
            _dessertRepoMock = new Mock<IDessertRepository>();
            _pictureServiceMock = new Mock<IPictureService>();
            _dessertServiceMock = new Mock<IDessertService>();
            _dessertVMMMock = new Mock<IDessertViewModelManager>();
            File.Copy(@"C:\Projects\LikeMyDessert\Projects\LikeMyDessert.Tests\IntegrationTests\Content\Test Pic.jpg", TEMP_PIC_FILE_PATH, true);
        }
        public void Context()
        {
            _testDessert = new Dessert
            {
                ID = _dessertGuid,
                Likes = 0,
            };

            _unitOfWorkMock = new Mock<IUnitOfWork>();
            _unitOfWorkMock.Setup(uow => uow.Get<Dessert>(_dessertGuid))
                .Returns(_testDessert);
            _unitOfWorkMock.Setup(uow => uow.Update(_testDessert));

            _httpHelperMock = new Mock<IHttpHelper>();

            _pictureServiceMock = new Mock<IPictureService>();

            _dessertServiceMock = new Mock<IDessertService>();
            _dessertServiceMock.Setup(svc => svc.LikeDessert(_dessertGuid));

            _dessertViewModelManagerMock = new Mock<IDessertViewModelManager>();
            _dessertViewModelManagerMock.Setup(vmm => vmm.Like(_dessertGuid));
        }
        public void Context()
        {
            _testPic = new Picture
            {
                Alt = "Second Test Pic",
                OrdinalIndex = 0,
                ImageType = "jpg",
            };
            UnitOfWork.AddToSession(_testPic);

            _testDessert = new Dessert
            {
                Name = "Test Dessert",
                Description = "A yummy tasty treat",
                Likes = 0,
                Picture = _testPic
            };
            UnitOfWork.AddToSession(_testDessert);

            PersistenceManager.CommitCachedObjects();
        }
 public void Save(Dessert dessert)
 {
     _dessertRepository.Save(dessert);
 }