private Stopwatch GetTimer(NetUser user) { if (user.GetLocal <Stopwatch>(TimerKey) == null) { user.SetLocal <Stopwatch>(TimerKey, new Stopwatch()); } return(user.GetLocal <Stopwatch>(TimerKey)); }
public void NetUser_SetLocal_StringKey_GetLocalReturnsValue() { NetUser user = new NetUser(); user.SetLocal("key", "data"); var data = user.GetLocal("key"); Assert.IsTrue(data.Equals("data")); }
public void NetUser_SetLocal_GenericKey_GetLocalReturnsValue() { NetUser user = new NetUser(); TestModel model = new TestModel(); model.Data = "data"; user.SetLocal <TestModel>("key", model); var m = user.GetLocal <TestModel>("key"); Assert.IsTrue(m.Data.Equals(model.Data)); }