public void WhenActivityNotFoundReturnsNull()
 {
     var showActivityCommand = new ShowActivityQuery { ActivityId = 1 };
     var dataAccess = new Mock<IAllReadyDataAccess>();
     dataAccess.Setup(x => x.GetActivity(showActivityCommand.ActivityId))
               .Returns<Models.Activity>(null);
     var sut = new ShowActivityQueryHandler(dataAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldBeNull();
 }
 public void HappyPath()
 {
     var showActivityCommand = new ShowActivityQuery { 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 ShowActivityQueryHandler(mockDbAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldNotBeNull();
 }
 public void WhenActivityCampaignIsLockedReturnsNull()
 {
     var showActivityCommand = new ShowActivityQuery { 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 ShowActivityQueryHandler(mockDbAccess.Object);
     var viewModel = sut.Handle(showActivityCommand);
     viewModel.ShouldBeNull();
 }
Exemplo n.º 4
0
        public void WhenActivityNotFoundReturnsNull()
        {
            var showActivityCommand = new ShowActivityQuery {
                ActivityId = 1
            };
            var dataAccess = new Mock <IAllReadyDataAccess>();

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

            viewModel.ShouldBeNull();
        }
Exemplo n.º 5
0
        public void HappyPath()
        {
            var showActivityCommand = new ShowActivityQuery {
                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 ShowActivityQueryHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showActivityCommand);

            viewModel.ShouldNotBeNull();
        }
Exemplo n.º 6
0
        public void WhenActivityCampaignIsLockedReturnsNull()
        {
            var showActivityCommand = new ShowActivityQuery {
                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 ShowActivityQueryHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showActivityCommand);

            viewModel.ShouldBeNull();
        }