Example #1
0
    public void TestAddingEnum()
    {
        //Given
        IAvatarData  avatarDb    = new AvatarData();
        ICommentData commentData = new CommentData();
        //When


        var finalComment = new Comment()
        {
            Id       = 12,
            AvatarId = 1,
            Message  = "HELLO IS THIS WORKING?",
            PostedOn = DateTime.UtcNow,
        };

        // comments = comments.Concat(new List<Comment> {finalComment});
        CommentData.CurrentComments.Comments.Add(finalComment);
        // commentData.AddComment(finalComment);
        var comments = commentData.GetAllComment();
        var avatar   = avatarDb.GetAvatarById(1);

        // avatar.Comments.ToList().Add(finalComment);
        foreach (var item in comments)
        {
            output.WriteLine("{0}, ID: {1}, CommentId: {2}", item.Message, item.AvatarId, item.Id);
        }
        var result = avatar.Comments.FirstOrDefault(c => c.Id == 12);

        if (result == null)
        {
            output.WriteLine("Nothing was found!!");
        }
        else
        {
            foreach (var item in avatar.Comments)
            {
                output.WriteLine("From Avatar: {0} ID:{1}", item.Message, item.Id);
            }
        }
        //Then
        Assert.Equal(4, avatar.TotalComments);
    }