예제 #1
0
        public void CanSaveOrUpdateValidSlideFolder()
        {
            // Establish Context
            SlideFolder validSlideFolder =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            // Act
            ActionConfirmation confirmation =
                slideFolderManagementService.SaveOrUpdate(validSlideFolder);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(validSlideFolder);
        }
예제 #2
0
        public void CanGetSlideFolder()
        {
            // Establish Context
            SlideFolder slideFolderToExpect =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            slideFolderRepository.Expect(r => r.Get(1))
            .Return(slideFolderToExpect);

            // Act
            SlideFolder slideFolderRetrieved =
                slideFolderManagementService.Get(1);

            // Assert
            slideFolderRetrieved.ShouldNotBeNull();
            slideFolderRetrieved.ShouldEqual(slideFolderToExpect);
        }
예제 #3
0
        public void CanShowSlideFolder()
        {
            // Establish Context
            SlideFolder slideFolder =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            slideFolderManagementService.Expect(r => r.Get(1))
            .Return(slideFolder);

            // Act
            ViewResult result = slideFoldersController.Show(1).AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as SlideFolder).ShouldNotBeNull();
            (result.ViewData.Model as SlideFolder).ShouldEqual(slideFolder);
        }
예제 #4
0
        public void CanCreateFormViewModelForSlideFolder()
        {
            // Establish Context
            SlideFolderFormViewModel viewModelToExpect = new SlideFolderFormViewModel();

            SlideFolder slideFolder =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            slideFolderRepository.Expect(r => r.Get(1))
            .Return(slideFolder);

            // Act
            SlideFolderFormViewModel viewModelRetrieved =
                slideFolderManagementService.CreateFormViewModelFor(1);

            // Assert
            viewModelRetrieved.ShouldNotBeNull();
            viewModelRetrieved.SlideFolder.ShouldNotBeNull();
            viewModelRetrieved.SlideFolder.ShouldEqual(slideFolder);
        }
예제 #5
0
        public void CanGetAllSlideFolders()
        {
            // Establish Context
            IList <SlideFolder> slideFoldersToExpect = new List <SlideFolder>();

            SlideFolder slideFolder =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            slideFoldersToExpect.Add(slideFolder);

            slideFolderRepository.Expect(r => r.GetAll())
            .Return(slideFoldersToExpect);

            // Act
            IList <SlideFolder> slideFoldersRetrieved =
                slideFolderManagementService.GetAll();

            // Assert
            slideFoldersRetrieved.ShouldNotBeNull();
            slideFoldersRetrieved.Count.ShouldEqual(1);
            slideFoldersRetrieved[0].ShouldNotBeNull();
            slideFoldersRetrieved[0].ShouldEqual(slideFolder);
        }
예제 #6
0
        public void CanUpdateWithValidSlideFolderFromForm()
        {
            // Establish Context
            SlideFolder validSlideFolderFromForm =
                SlideFolderInstanceFactory.CreateValidTransientSlideFolder();

            // Intentionally empty to ensure successful transfer of values
            SlideFolder slideFolderFromDb = new SlideFolder();

            slideFolderRepository.Expect(r => r.Get(1))
            .Return(slideFolderFromDb);

            // Act
            ActionConfirmation confirmation =
                slideFolderManagementService.UpdateWith(validSlideFolderFromForm, 1);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(slideFolderFromDb);
            confirmation.Value.ShouldEqual(validSlideFolderFromForm);
        }