コード例 #1
0
        public void MembershipGiveAndTakeModerator()
        {
            var mockDb = new MockDatabase();

            DoubleDb(mockDb);

            MembershipController controller = new MembershipController(mockDb);

            controller.GiveModeratorStatus(teamId: 1, toId: 2, fromId: 1);

            var result = controller.Get(2) as OkNegotiatedContentResult <Membership>;

            Assert.IsNotNull(result);

            Assert.AreEqual(1, result.Content.TeamId);
            Assert.AreEqual(2, result.Content.AccountId);
            Assert.AreEqual(MembershipStatus.Moderator, result.Content.Status);

            controller.RemoveModeratorStatus(teamId: 1, toId: 2, fromId: 1);

            result = controller.Get(2) as OkNegotiatedContentResult <Membership>;
            Assert.IsNotNull(result);

            Assert.AreEqual(1, result.Content.TeamId);
            Assert.AreEqual(2, result.Content.AccountId);
            Assert.AreEqual(MembershipStatus.Member, result.Content.Status);
        }
コード例 #2
0
        public void GetMembershipIfValidPsr()
        {
            // Arrange
            var psr = 10000005;

            var expected = new EF_Spike.Membership.Model.Membership
            {
                Psrnumber            = 10000005,
                MembershipReference  = 1,
                SectionNumber        = 0,
                LevyTagTypeReference = 2,
                EffectiveDate        = Convert.ToDateTime("1996-03-31T00:00:00"),
                EndDate             = null,
                EndEventReference   = null,
                AgeProfiling50to59  = null,
                AgeProfiling60Plus  = null,
                StartEventReference = 5
            };

            var tblMembership = AutoMapper.Mapper.Map <TblMembership>(expected);

            registryContext.Add(tblMembership);

            // Act
            var result = sut.Get(psr);

            var resolvedResult = resolver.GetOkResult(expected, result);

            // Assert
            Assert.True(resolvedResult.isOkResult);
            Assert.Equal(resolvedResult.expected, resolvedResult.result);
        }
コード例 #3
0
        public void MembershipBan()
        {
            var mockDb = new MockDatabase();

            DoubleDb(mockDb);

            MembershipController controller = new MembershipController(mockDb);

            controller.BanMember(teamId: 1, toId: 2, fromId: 1);

            var result = controller.Get(2) as OkNegotiatedContentResult <Membership>;

            Assert.IsNotNull(result);

            Assert.AreEqual(1, result.Content.TeamId);
            Assert.AreEqual(2, result.Content.AccountId);
            Assert.AreEqual(MembershipStatus.Banned, result.Content.Status);
        }
コード例 #4
0
        public void MembershipPostGetAccept()
        {
            var mockDb = new MockDatabase();

            BasicDb(mockDb);

            MembershipController controller = new MembershipController(mockDb);


            var membership = (controller.Accept(teamId: 1, userId: 2) as OkNegotiatedContentResult <Membership>).Content;
            var result     = controller.Get(membership.Id) as OkNegotiatedContentResult <Membership>;

            Assert.IsNotNull(result);

            Assert.AreEqual(1, result.Content.TeamId);
            Assert.AreEqual(2, result.Content.AccountId);
            Assert.AreEqual(MembershipStatus.Member, result.Content.Status);
        }