示例#1
0
    public void WithUserIdRecordsNewMemberCreatedEvent()
    {
        var member = MemberHelpers.CreateWithInternalConstructor();

        var eventCreated = (NewMemberCreatedEvent)member.Events.First();

        Assert.Same(member, eventCreated.Member);
    }
示例#2
0
        public void ReturnsProperMessageString()
        {
            Member member = MemberHelpers.CreateWithInternalConstructor();

            member.UpdateName("Steve", "Smith");

            MemberUpdatedEvent memberEvent = new MemberUpdatedEvent(member, "Links");

            var output   = DiscordLogMemberUpdateHandler.returnWebhookMessageString(memberEvent);
            var expected = $"User Steve Smith just updated their profile. Check it out here: https://devbetter.com/User/Details/TestUserId.";

            Assert.Equal(expected, output);
        }
    public void ShouldRemoveFavoriteArchiveVideoGivenExistingFavoriteArchiveVideo()
    {
        var member       = MemberHelpers.CreateWithInternalConstructor();
        var archiveVideo = new ArchiveVideo
        {
            Id = _validArchiveVideoId,
        };

        member.AddFavoriteArchiveVideo(archiveVideo);

        member.RemoveFavoriteArchiveVideo(archiveVideo);

        member.FavoriteArchiveVideos.Should().BeEmpty();
    }
    public void ShouldDoNothingGivenDuplicateArchiveVideo()
    {
        var member = MemberHelpers.CreateWithInternalConstructor();

        var archiveVideo = new ArchiveVideo
        {
            Id = _validArchiveVideoId,
        };

        member.AddFavoriteArchiveVideo(archiveVideo);
        member.AddFavoriteArchiveVideo(archiveVideo);

        member.FavoriteArchiveVideos.Count().Should().Be(1);
    }
    public void ShouldAddFavoriteArchiveVideoGivenArchiveVideo()
    {
        var member = MemberHelpers.CreateWithInternalConstructor();

        var archiveVideo = new ArchiveVideo
        {
            Id = _validArchiveVideoId,
        };

        member.AddFavoriteArchiveVideo(archiveVideo);

        using (new AssertionScope())
        {
            member.FavoriteArchiveVideos.Single().ArchiveVideoId.Should().Be(_validArchiveVideoId);
            member.FavoriteArchiveVideos.Single().MemberId.Should().Be(member.Id);
        }
    }
    public void ShouldDoNothingGivenFavoriteArchiveVideoNotInFavoriteArchiveVideos()
    {
        var member = MemberHelpers.CreateWithInternalConstructor();
        var existingArchiveVideo = new ArchiveVideo
        {
            Id = _validArchiveVideoId,
        };

        member.AddFavoriteArchiveVideo(existingArchiveVideo);
        int expectedCount = member.FavoriteArchiveVideos.Count();

        var nonexistingArchiveVideo = new ArchiveVideo
        {
            Id = _validArchiveVideoId + 1,
        };

        member.RemoveFavoriteArchiveVideo(nonexistingArchiveVideo);

        member.FavoriteArchiveVideos.Count().Should().Be(expectedCount);
    }
示例#7
0
    public void RequiresUserIdForInternalUsage()
    {
        var member = MemberHelpers.CreateWithInternalConstructor();

        Assert.Equal(MemberHelpers.TEST_USER_ID, member.UserId);
    }