public void Create_DataCorrect_ReferralCreated()
        {
            var user     = UserFaker.Create();
            var referral = UserFaker.Create();

            UserReferralRepository.Create(user, referral);

            var invitedUsers = UserReferralRepository.GetInvited(referral);

            Assert.AreEqual(invitedUsers[0].referral_id, referral.id);
        }
Пример #2
0
        public ReferralController()
        {
            Get("/api/v1/me/referral_key/get", _ => {
                var me = UserRepository.Find(CurrentRequest.UserId);
                return(HttpResponse.Data(new JObject()
                {
                    ["referral_key"] = me.guid
                }));
            });

            Get("/api/v1/me/referred/get", _ => {
                var me = UserRepository.Find(CurrentRequest.UserId);
                return(HttpResponse.Data(new JObject()
                {
                    ["referred_users"] = new UserReferralTransformer().Many(UserReferralRepository.GetInvited(me))
                }));
            });
        }