Example #1
0
        public void Can_get_user_timeZone_with_customTimeZones_enabled()
        {
            _dateTimeSettings.AllowUsersToSetTimeZone = true;
            _dateTimeSettings.DefaultTimeZoneId       = _gmtPlus2MinskTimeZoneId;

            var user = new User {
                Id = 10
            };

            _genericAttributeService.Setup(x => x.GetAttributeAsync <string>(user, UserDefaults.TimeZoneIdAttribute, 0))
            .ReturnsAsync(_gmtPlus3MoscowTimeZoneId);

            var timeZone = _dateTimeHelper.GetUserTimeZone(user).Result;

            timeZone.ShouldNotBeNull();
            timeZone.Id.ShouldEqual(_gmtPlus3MoscowTimeZoneId);
        }