当前位置: 首页>>代码示例>>C#>>正文


C# ItineraryController.ConfirmRemoveTeamMember方法代码示例

本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController.ConfirmRemoveTeamMember方法的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController.ConfirmRemoveTeamMember方法的具体用法?C# ItineraryController.ConfirmRemoveTeamMember怎么用?C# ItineraryController.ConfirmRemoveTeamMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AllReady.Areas.Admin.Controllers.ItineraryController的用法示例。


在下文中一共展示了ItineraryController.ConfirmRemoveTeamMember方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfirmRemoveTeamMemberReturnsHttpNotFound_WhenTaskSignupSummaryModelIsNull

        public async Task ConfirmRemoveTeamMemberReturnsHttpNotFound_WhenTaskSignupSummaryModelIsNull()
        {
            const int orgId = 1;

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
            mockMediator.Setup(x => x.SendAsync(It.IsAny<TaskSignupSummaryQuery>())).ReturnsAsync(null);

            var sut = new ItineraryController(mockMediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());

            Assert.IsType<NotFoundResult>(await sut.ConfirmRemoveTeamMember(It.IsAny<int>(), It.IsAny<int>()));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:13,代码来源:ItineraryAdminControllerTests.cs

示例2: ConfirmRemoveTeamMemberReturnsTheCorrectViewAndViewModel

        public async Task ConfirmRemoveTeamMemberReturnsTheCorrectViewAndViewModel()
        {
            const int orgId = 1;

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
            mockMediator.Setup(x => x.SendAsync(It.IsAny<TaskSignupSummaryQuery>())).ReturnsAsync(new TaskSignupSummaryViewModel { TaskSignupId = It.IsAny<int>(), VolunteerEmail = "[email protected]", VolunteerName = "Test McTesterson" });

            var sut = new ItineraryController(mockMediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());

            var result = await sut.ConfirmRemoveTeamMember(It.IsAny<int>(), It.IsAny<int>()) as ViewResult;

            Assert.Equal(result.ViewName, "ConfirmRemoveTeamMember");

            var resultViewModel = result.ViewData.Model;
            Assert.IsType<TaskSignupSummaryViewModel>(resultViewModel);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:18,代码来源:ItineraryAdminControllerTests.cs

示例3: ConfirmRemoveTeamMemberReturnsHttpUnauthorized_WhenUserIsNotOrgAdmin

        public async Task ConfirmRemoveTeamMemberReturnsHttpUnauthorized_WhenUserIsNotOrgAdmin()
        {
            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);

            var sut = new ItineraryController(mockMediator.Object, null);
            sut.MakeUserNotAnOrgAdmin();

            Assert.IsType<UnauthorizedResult>(await sut.ConfirmRemoveTeamMember(It.IsAny<int>(), It.IsAny<int>()));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs

示例4: ItineraryController

        public async Task ConfirmRemoveTeamMemberSendsTaskSignupSummaryQueryWithCorrectTaskSignupIdWhenOrganizationIdIsNotZero_AndUserIsOrgAdmin()
        {
            const int orgId = 1;
            const int taskSignupId = 1;

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);

            var sut = new ItineraryController(mockMediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());

            await sut.ConfirmRemoveTeamMember(It.IsAny<int>(), taskSignupId);

            mockMediator.Verify(x => x.SendAsync(It.Is<TaskSignupSummaryQuery>(y => y.TaskSignupId == taskSignupId)), Times.Once);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:15,代码来源:ItineraryAdminControllerTests.cs

示例5: ConfirmRemoveTeamMemberSendsOrganizationIdQueryWithTheCorrectItineraryId

        public async Task ConfirmRemoveTeamMemberSendsOrganizationIdQueryWithTheCorrectItineraryId()
        {
            const int itineraryId = 1;

            var mockMediator = new Mock<IMediator>();

            var sut = new ItineraryController(mockMediator.Object, null);

            await sut.ConfirmRemoveTeamMember(itineraryId, It.IsAny<int>());

            mockMediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:12,代码来源:ItineraryAdminControllerTests.cs

示例6: ConfirmRemoveTeamMemberReturnsHttpUnauthorized_WhenOrganizationIdIsZero

        public async Task ConfirmRemoveTeamMemberReturnsHttpUnauthorized_WhenOrganizationIdIsZero()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(0);

            var sut = new ItineraryController(mockMediator.Object, null);

            Assert.IsType<UnauthorizedResult>(await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:12,代码来源:ItineraryAdminControllerTests.cs

示例7: ConfirmRemoveTeamMemberReturnsTheCorrectViewAndViewModel

        public async Task ConfirmRemoveTeamMemberReturnsTheCorrectViewAndViewModel()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
            mockMediator.Setup(x => x.SendAsync(It.IsAny<TaskSignupSummaryQuery>())).ReturnsAsync(new TaskSignupSummaryModel { TaskSignupId = taskSignupId, VolunteerEmail = "[email protected]", VolunteerName = "Test McTesterson"});

            var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
            sut.SetClaims(new List<Claim>
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
                new Claim(AllReady.Security.ClaimTypes.Organization, "1")
            });

            var result = await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId) as ViewResult;

            Assert.Equal(result.ViewName, "ConfirmRemoveTeamMember");

            var resultViewModel = result.ViewData.Model;
            Assert.IsType<TaskSignupSummaryModel>(resultViewModel);
        }
开发者ID:yobenzima,项目名称:allReady,代码行数:23,代码来源:ItineraryAdminControllerTests.cs

示例8: ConfirmRemoveTeamMemberReturnsHttpNotFoundWhenTaskSignupSummaryModelIsNull

        public async Task ConfirmRemoveTeamMemberReturnsHttpNotFoundWhenTaskSignupSummaryModelIsNull()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
            mockMediator.Setup(x => x.SendAsync(It.IsAny<TaskSignupSummaryQuery>())).ReturnsAsync(null);

            var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
            sut.SetClaims(new List<Claim>
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
                new Claim(AllReady.Security.ClaimTypes.Organization, "1")
            });

            Assert.IsType<HttpNotFoundResult>(await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId));
        }
开发者ID:yobenzima,项目名称:allReady,代码行数:18,代码来源:ItineraryAdminControllerTests.cs

示例9: ItineraryController

        public async Task ConfirmRemoveTeamMemberSendsTaskSignupSummaryQueryWithCorrectTaskSignupIdWhenOrganizationIdIsNotZero_AndUserIsOrgAdmin()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);

            var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
            sut.SetClaims(new List<Claim>
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
                new Claim(AllReady.Security.ClaimTypes.Organization, "1")
            });

            await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId);

            mockMediator.Verify(x => x.SendAsync(It.Is<TaskSignupSummaryQuery>(y => y.TaskSignupId == taskSignupId)), Times.Once);
        }
开发者ID:yobenzima,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs

示例10: ConfirmRemoveTeamMemberSendsOrganizationIdQueryWithTheCorrectItineraryId

        public async Task ConfirmRemoveTeamMemberSendsOrganizationIdQueryWithTheCorrectItineraryId()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();

            var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);

            await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId);

            mockMediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
        }
开发者ID:yobenzima,项目名称:allReady,代码行数:13,代码来源:ItineraryAdminControllerTests.cs

示例11: ConfirmRemoveTeamMemberReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin

        public async Task ConfirmRemoveTeamMemberReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin()
        {
            var itineraryId = It.IsAny<int>();
            var taskSignupId = It.IsAny<int>();

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);

            var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
            sut.SetClaims(new List<Claim>
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, UserType.BasicUser.ToString())
            });

            Assert.IsType<UnauthorizedResult>(await sut.ConfirmRemoveTeamMember(itineraryId, taskSignupId));
        }
开发者ID:gftrader,项目名称:allReady,代码行数:16,代码来源:ItineraryAdminControllerTests.cs


注:本文中的AllReady.Areas.Admin.Controllers.ItineraryController.ConfirmRemoveTeamMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。