Ejemplo n.º 1
0
        public void Users_POST_NewMember_ShouldSendInvite()
        {
            var instance = InitWithSingleMember();

            var controller = new InviteController();
            controller.UserInfo = new UserInfo { Id = 12 };

            var vm = new InviteViewModel
            {
                Emails = "*****@*****.**"
            };

            var result = controller.Users(instance.Id, vm) as RedirectToRouteResult;
            Assert.IsNotNull(result);

            DB.Use(db =>
            {
                var invite = db.Invites.Single();
                Assert.AreEqual("*****@*****.**", invite.Email);
                Assert.IsNotNull(invite.Code);
                Assert.AreEqual(instance.Id, invite.InstanceId);

                Assert.AreEqual(1, db.Users.Count());
            });
        }
Ejemplo n.º 2
0
        public void Users_GET_Member_ShouldGetGroupData()
        {
            var instance = InitWithSingleMember();

            var controller = new InviteController();
            controller.UserInfo = new UserInfo { Id = 12 };

            var data = DataFromView<InviteViewModel>(controller.Users(instance.Id));

            Assert.AreEqual("Name", data.InstanceName);
            Assert.AreEqual(instance.Id, data.InstanceId);
        }
Ejemplo n.º 3
0
        public void Users_GET_NotMember_ShouldGetException()
        {
            var user = new User { UserId = 12 };
            var instance = new Instance { Started = DateTime.Now };

            InitDb(db =>
            {
                db.Users.Add(user);
                db.Instances.Add(instance);

                db.SaveChanges();
            });

            var controller = new InviteController();
            controller.UserInfo = new UserInfo { Id = 12 };

            var data = DataFromView<InviteViewModel>(controller.Users(instance.Id));
        }