Biblical source: “… Ekev asher shama Avraham bekoli… – because Avraham listened to Me, and he kept mishmarti, mitzvotei, chukotei, v’torotei.” (Bereshit 26:5)
The Avot were commanded to keep the seven noachide laws and indeed kept them, but they were not commanded to keep the other mitzvot – did the Avot keep the Torah before it had been given?
There are several examples of the Avot (and others) going against Torah commands; Yaakov married two sisters, Yaakov made Yosef the firstborn over Reuven a prohibition in Devarim 21.16 and Amram married his aunt Yocheved. So did they keep the entire Torah or not?
1. Mishnah Kiddushin 82a, Yoma 28b says that Avraham kept all the Torah he even kept future Rabbinic laws too. He knew the Torah because he had ruach hakodesh (Ramban Bereshit 26.5).
2. Rashi Bereshit 26.5: The Avot kept the entire Torah – even the Oral Law and later Rabbinic prohibitions.
3. Rema, Rav Moshe Isserlis, in Shut Rema siman 10 writes that only Avraham kept all the Torah and not the other Avot. Other commentators  show that others knew and kept the Torah too.
4. Ramban Bereshit 26.5 asks how Yaakov could marry two sisters, this is prohibited by Vayikra 18.18. He answers that the Avot only kept the entire Torah in Eretz Yisrael, and Yaakov married the two sisters [and refigured the firstborn] in chutz l’aretz; this is why Rachel died on the way to Eretz Yisrael. 
5. Maharal Gur Aryeh Bereshit 46.10 (and 32.4), and Chiddushei Aggadot Chullin 91a states that the Avot only kept the positive mitzvot but not the negative mitzvot. The reason is, he explains, that one can still get reward and achieve spiritual results for keeping positive mitzvot even when not commanded (e.g. a woman shaking lulav), but breaking a negative commandment is only spiritually damaging when it goes against something HaShem has commanded us not to do. And since the Torah had not been given yet, the Avot had not been commanded by HaShem about the negative prohibitions; not to marry two sisters, for example.
6. Rambam Igrot HaRambam; Iggeret leRav Chisdai HaLevi L’Alexandria also the opinion of the Oneg Yom Tov in his introduction, as well as Rav Avraham ben HaRambam al HaTorah: The Avot did not keep the mitzvot, but rather got to their lofty spiritual level by ‘having understood everything there is to understand in true wisdom and corrected themselves in every way.’ What the Rambam means is each mitzvah achieves a certain spiritual effect/tikun, the Avot had the ability to be able to tap into creating these effects and tikkunim without necessarily performing the technical details of the mitzvah.
7. Ridbaz & Maharsha (Shut Ridbaz 696, Maharsha Yoma 28b ‘mitzvotai’) the Avot kept the entire Torah and the reason that Yaakov could marry two sisters is based on the dictum that a convert to Judaism is considered like a newborn baby (Yevamot 22a.)
8. Or HaChaim Bereshit 49.3 the Avot knew and kept the entire Torah, but the discrepancies above were instances where they received a specific prophecy temporarily suspending a mitzvah.
9. Da’at Zekeinim Bereshit 37.35 and Nefesh HaChaim sha’ar alef chapter 21 The Avot kept and knew the Torah and its mitzvot through ruach hakodesh (Divine inspiration), they also saw via ruach hakodesh that in specific situations there would be a great benefit which allowed them to ‘deviate’ from the Torah. Examples of this ‘great benefit’ are marrying two sisters in order to build Klal Yisrael, or the specific insight of Yaakov to realize that Yosef was more spiritually befitting the firstborn status than Reuven. Once the Torah was given, however, the commandments were to be kept unswervingly with no regard to any perceived ‘great benefit’ in failing to observe them. Nefesh HaChaim states that this is a reason that HaShem did not give the Torah to the Avot.
 Rav Osher Weis’s ‘Minchas Osher,’ Parashat Vayishlach. Ramban in Bereshit 26.5 states that Yosef learnt Torah with his father Yaakov and kept Shabbat in Egypt; Yehuda fulfilled the mitzvah of yibum, Rashi Bereshit 7.2 and 45.27 quotes some of these sources. Obviously, the Rema knew these sources too, and so must have had answers.
 It is implicit that Rashi Bereshit 32.5 argues with this answer, he explains Yaakov’s message to Esav to be ‘I kept all the mitzvot even in the house of Lavan;’ who lived outside Eretz Yisrael. However, according to the Divrei David brought by the Sifte Chachamim ad loc, Rashi means that Yaakov learnt all the mitzvot of the Torah during his time with Lavan, and we have a principle that to a certain extent learning a mitzvah is like fulfilling it (e.g saying korbanot is like offering a sacrifice; Menachot 110a).