public void CanSaveOrUpdateValidchannel()
        {
            // Establish Context
            Channel validchannel =
                ChannelInstanceFactory.CreateValidTransientChannel();

            // Act
            ActionConfirmation confirmation =
                channelManagementService.SaveOrUpdate(validchannel);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(validchannel);
        }
Пример #2
0
        public void CanShowChannels()
        {
            // Establish Context
            Channel channel =
                ChannelInstanceFactory.CreateValidTransientChannel();

            channelManagementService.Expect(r => r.Get(1))
            .Return(channel);

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

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as Channel).ShouldNotBeNull();
            (result.ViewData.Model as Channel).ShouldEqual(channel);
        }
        public void CanGetchannel()
        {
            // Establish Context
            Channel channelToExpect =
                ChannelInstanceFactory.CreateValidTransientChannel();

            channelRepository.Expect(r => r.Get(1))
            .Return(channelToExpect);

            // Act
            Channel channelRetrieved =
                channelManagementService.Get(1);

            // Assert
            channelRetrieved.ShouldNotBeNull();
            channelRetrieved.ShouldEqual(channelToExpect);
        }
        public void CanCreateFormViewModelForchannel()
        {
            // Establish Context
            ChannelFormViewModel viewModelToExpect = new ChannelFormViewModel();

            Channel channel =
                ChannelInstanceFactory.CreateValidTransientChannel();

            channelRepository.Expect(r => r.Get(1))
            .Return(channel);

            // Act
            ChannelFormViewModel viewModelRetrieved =
                channelManagementService.CreateFormViewModelFor(1);

            // Assert
            viewModelRetrieved.ShouldNotBeNull();
            viewModelRetrieved.Channel.ShouldNotBeNull();
            viewModelRetrieved.Channel.ShouldEqual(channel);
        }
        public void CanGetAllchannel()
        {
            // Establish Context
            IList <Channel> channelToExpect = new List <Channel>();

            Channel channel =
                ChannelInstanceFactory.CreateValidTransientChannel();

            channelToExpect.Add(channel);

            channelRepository.Expect(r => r.GetAll())
            .Return(channelToExpect);

            // Act
            IList <Channel> channelRetrieved =
                channelManagementService.GetAll();

            // Assert
            channelRetrieved.ShouldNotBeNull();
            channelRetrieved.Count.ShouldEqual(1);
            channelRetrieved[0].ShouldNotBeNull();
            channelRetrieved[0].ShouldEqual(channel);
        }
        public void CanUpdateWithValidchannelFromForm()
        {
            // Establish Context
            Channel validchannelFromForm =
                ChannelInstanceFactory.CreateValidTransientChannel();

            // Intentionally empty to ensure successful transfer of values
            Channel channelFromDb = new Channel();

            channelRepository.Expect(r => r.Get(1))
            .Return(channelFromDb);

            // Act
            ActionConfirmation confirmation =
                channelManagementService.UpdateWith(validchannelFromForm, 1);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldNotBeNull();
            confirmation.Value.ShouldEqual(channelFromDb);
            confirmation.Value.ShouldEqual(validchannelFromForm);
        }