public void WhenActivityNotFoundReturnsNull()
 {
     var showActivityCommand = new ShowActivityCommand { ActivityId = 1 };
     var dataAccess = new Mock<IAllReadyDataAccess>();
     dataAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
               .Returns<Models.Activity>(null);
     var sut = new ShowActivityHandler(dataAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldBeNull();
 }
 public void HappyPath()
 {
     var showActivityCommand = new ShowActivityCommand { ActivityId = 1, User = ClaimsPrincipal.Current };
     var mockDbAccess = new Mock<IAllReadyDataAccess>();
     var expectedActivity = new Models.Activity { Campaign = new Campaign { Locked = false } };
     mockDbAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
                 .Returns(expectedActivity);
     var sut = new ShowActivityHandler(mockDbAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldNotBeNull();
 }
 public void WhenActivityCampaignIsLockedReturnsNull()
 {
     var showActivityCommand = new ShowActivityCommand { ActivityId = 1 };
     var mockDbAccess = new Mock<IAllReadyDataAccess>();
     var expectedActivity = new Models.Activity { Campaign = new Campaign { Locked = true } };
     mockDbAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
                 .Returns(expectedActivity);
     var sut = new ShowActivityHandler(mockDbAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldBeNull();
 }
Example #4
0
        public void WhenActivityNotFoundReturnsNull()
        {
            var showActivityCommand = new ShowActivityCommand {
                ActivityId = 1
            };
            var dataAccess = new Mock <IAllReadyDataAccess>();

            dataAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
            .Returns <Models.Activity>(null);
            var sut       = new ShowActivityHandler(dataAccess.Object);
            var viewModel = sut.Handle(showActivityCommand);

            viewModel.ShouldBeNull();
        }
Example #5
0
        public void HappyPath()
        {
            var showActivityCommand = new ShowActivityCommand {
                ActivityId = 1, User = ClaimsPrincipal.Current
            };
            var mockDbAccess     = new Mock <IAllReadyDataAccess>();
            var expectedActivity = new Models.Activity {
                Campaign = new Campaign {
                    Locked = false
                }
            };

            mockDbAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
            .Returns(expectedActivity);
            var sut       = new ShowActivityHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showActivityCommand);

            viewModel.ShouldNotBeNull();
        }
Example #6
0
        public void WhenActivityCampaignIsLockedReturnsNull()
        {
            var showActivityCommand = new ShowActivityCommand {
                ActivityId = 1
            };
            var mockDbAccess     = new Mock <IAllReadyDataAccess>();
            var expectedActivity = new Models.Activity {
                Campaign = new Campaign {
                    Locked = true
                }
            };

            mockDbAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
            .Returns(expectedActivity);
            var sut       = new ShowActivityHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showActivityCommand);

            viewModel.ShouldBeNull();
        }