public void Register() { IUserService service = client.CreateInstance<IUserService>(); User user = new User { EMail = "*****@*****.**", Name = "henry" }; User result = service.Register(user); Assert.AreEqual(user.Name, result.Name); Assert.AreNotEqual(user.CreateTime, result.CreateTime); }
static void Main(string[] args) { System.Threading.Timer mTimer; try { DateTime dt; ProtoClient client = new ProtoClient("127.0.0.1"); client.Receive = (o, e) => { Console.WriteLine("Receive From Server:{0}", e.Message); }; User user = new User { EMail = "*****@*****.**", Name = "henry" }; client.Send(user); IUserService us = client.CreateInstance<IUserService>(); user = us.Register(user); Console.WriteLine(user.CreateTime); user = us.Register("henry", null); Console.WriteLine(user.CreateTime); user = us.Register("henry", "*****@*****.**", out dt); Console.WriteLine(dt); user = us.ReturnNull(); Console.WriteLine(user == null); us.GetTime(out dt); Console.WriteLine(dt); //mTimer = new System.Threading.Timer(d => //{ // DateTime s; // us.GetTime(out s); // Console.WriteLine(s); //}, null, 1000, 1000); } catch (Exception e_) { Console.WriteLine(e_); } Console.Read(); }
public User Register(string name, string email, out DateTime createTime) { createTime = DateTime.Now; User user = new User() { Name = name, EMail = email }; return user; }
public User Register(string name, string email) { User user = new User() { Name = name, EMail = email, CreateTime = DateTime.Now }; return user; }
public User Register(User user) { user.CreateTime = DateTime.Now; return user; }
public User Regisetr(ISession session, User user) { user.CreateTime = DateTime.Now; "Register invoke[Name:{0} Email:{1}]".Log4Debug(user.Name, user.EMail); return user; }