Пример #1
0
 public void SignUpForEvent(string userEmail, int eventId)
 {
     try
     {
         eCtrl.SignUpForEvent(userEmail, eventId);
     }
     catch (ArgumentException aex)
     {
         throw new FaultException(aex.Message);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #2
0
        public void TestSignUpForEvent()
        {
            var user  = new UserCtrl().CreateUser("Fornavn", "Efternavn", "*****@*****.**" + Guid.NewGuid(), "123456");
            var eCtrl = new EventCtrl();
            var e     = eCtrl.CreateEvent("dsd", "dewdc", 23, 213.3, 21312.3, "here", DateTime.Now.AddHours(5), false, user);


            // Act
            eCtrl.SignUpForEvent(user.Email, e.Id);

            // Assert
            using (var ctx = new DALContext())
            {
                var reg = new UserCtrl().FindByEmail(user.Email).Registrations[0];

                var found = ctx.Registrations.Find(reg.Id);
                Assert.AreEqual(reg.Id, found.Id);
            }
        }