As to what I would do if Mary appeared to me; I would consider the fruits of the encounter. After all, the devil or a demon cannot appear to a person unless God allows the demon to, so there are a few possibilities:
She may not say anything. In this case, I would be almost certain that the encounter was a true vision or visitation because what would the demon stand to gain by appearing to me and doing nothing? If the fruits of the encounter were to lead me to deeper prayer, or progress in virtue, my certainty would increase further. If these appearances became numerious, and I was of sound mind, I would have to consider why they are occuring, which may be for a variety of reasons.
She may, on the other hand, say something. In this case, I would know if the visitation were legitimate or not by comparison. Because of the Church, I would be able to measure what she says to Divine Revelation; private Revelation is subservient to public Revelation. If the visitation said something contrary to the Faith (such as 'My Son is not God, but only a manifestation of the True God.') I would know the visitation is false. If, however, what she said to me was not contrary to the faith, but merely encouraged me to do something that was good that I had neglected (like 'I want you to stop arguing online so much and devote more of your time to prayer"), I could consider that the visitation was true.
As to what I would actually do as she/it was standing/floated/swimming in front of me; I certainly wouldn't rebuke it (after all, the first words out of Mary's mouth to Gabriel were not 'I rebuke you in the Name of the God of Israel!!!). I would pray and inquire as to why she/it was here with me. Since she was Mary, I would ask also to touch her; since she has a body, I sould be able to feel her physicality.