public void GetStorageExpression() { var declaringType = ObjectMother.GetDeclaringType(); var field = ObjectMother.GetFieldInfo(declaringType: declaringType); var thisExpression = ObjectMother.GetThisExpression(declaringType); var storage = new InstanceStorage(field); var result = storage.CreateStorageExpression(thisExpression); Assert.That(result, Is.InstanceOf <MemberExpression>()); var memberExpression = (MemberExpression)result; Assert.That(memberExpression.Member, Is.SameAs(field)); Assert.That(memberExpression.Expression, Is.SameAs(thisExpression)); }
private void Init() { _loginId = new ResettableLazyDirty <int>(() => HabboActions.GetLoginIdFromHabboId(Id)); _username = new ResettableLazyDirty <string>(() => HabboActions.GetHabboUsernameFromHabboId(Id)); _dateCreated = new ResettableLazyDirty <DateTime>(() => HabboActions.GetCreationDateFromHabboId(Id)); _lastAccess = new ResettableLazyDirty <DateTime>(() => HabboActions.GetLastAccessDateFromHabboId(Id)); _credits = new ResettableLazyDirty <int>(() => HabboActions.GetCreditsFromHabboId(Id)); _instanceStorage = new InstanceStorage(); _persistentStorage = new PersistentStorage(this); _permissions = new ResettableLazyDirty <IDictionary <string, PermissionState> >(() => CoreManager.ServerCore.PermissionDistributor.GetHabboPermissions(this)); _figure = new ResettableLazyDirty <HabboFigure>(() => LoadFigure()); _motto = new ResettableLazyDirty <string>(() => HabboActions.GetMottoFromHabboId(Id)); MessengerCategories = new HashSet <MessengerCategory>(); }
private SimpleDependencyContainer(string scopeName, SimpleDependencyContainer parentContainer) { Ensure.NotNullOrEmpty(scopeName, "scopeName"); this.scopeName = scopeName; this.parentContainer = parentContainer; InstanceStorage instances = new InstanceStorage(); if (parentContainer == null) { this.definitions = new DependencyDefinitionCollection(scopeName, instances); } else { this.definitions = new DependencyDefinitionCollection(scopeName, instances, parentContainer.definitions); } this.resolver = new InstanceResolver(definitions, instances); definitions.Add(typeof(IDependencyContainer), DependencyLifetime.NameScope(scopeName), this); definitions.Add(typeof(IDependencyProvider), DependencyLifetime.NameScope(scopeName), this); }
private void Init() { _loginId = new ResettableLazyDirty<int>(() => HabboActions.GetLoginIdFromHabboId(Id)); _username = new ResettableLazyDirty<string>(() => HabboActions.GetHabboUsernameFromHabboId(Id)); _dateCreated = new ResettableLazyDirty<DateTime>(() => HabboActions.GetCreationDateFromHabboId(Id)); _lastAccess = new ResettableLazyDirty<DateTime>(() => HabboActions.GetLastAccessDateFromHabboId(Id)); _credits = new ResettableLazyDirty<int>(() => HabboActions.GetCreditsFromHabboId(Id)); _instanceStorage = new InstanceStorage(); _persistentStorage = new PersistentStorage(this); _permissions = new ResettableLazyDirty<IDictionary<string, PermissionState>>(() => CoreManager.ServerCore.PermissionDistributor.GetHabboPermissions(this)); _figure = new ResettableLazyDirty<HabboFigure>(() => LoadFigure()); _motto = new ResettableLazyDirty<string>(() => HabboActions.GetMottoFromHabboId(Id)); MessengerCategories = new HashSet<MessengerCategory>(); }