public void fromOlsonTz_itReturnsPacificTimeWithUnknownTimeZones()
        {
            var tz = TimeZoneConverter.fromOlsonTz("SomeInvalid/TimeZone");

            Assert.True(tz is TimeZoneInfo);
            Assert.AreEqual("Pacific Standard Time", tz.Id);
        }
示例#2
0
        /// <summary>
        /// Initialize the Group
        /// </summary>
        /// <returns></returns>
        public Group New(Saml.Response samlResponse)
        {
            if (samlResponse != null)
            {
                NameValueCollection att = samlResponse.GetAttributes();

                // General info
                Uid           = att["group_uid"];
                Name          = att["group_name"];
                Email         = att["group_email"];
                CompanyName   = att["company_name"];
                HasCreditCard = att["group_has_credit_card"].Equals("true");

                // Set Free trial in the past on failure
                try
                {
                    FreeTrialEndAt = DateTime.Parse(att["group_end_free_trial"]);
                }
                catch
                {
                    FreeTrialEndAt = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                }

                // Geo info
                Currency = att["group_currency"];
                Timezone = TimeZoneConverter.fromOlsonTz(att["group_timezone"]);
                Country  = att["group_country"];
                City     = att["group_city"];
            }

            return(this);
        }
        public void fromOlsonTz_itReturnsANativeTimeZone()
        {
            var tz = TimeZoneConverter.fromOlsonTz("Europe/Rome");

            Assert.True(tz is TimeZoneInfo);
            Assert.AreEqual("W. Europe Standard Time", tz.Id);
        }
示例#4
0
        public void ItShouldExtractTheRightAttributesFromTheSamlResponse()
        {
            SsoResponseStub samlResp = new SsoResponseStub();
            var             att      = samlResp.GetAttributes();
            var             group    = new Group(samlResp);

            Assert.AreEqual(att["group_uid"], group.Uid);
            Assert.AreEqual(att["group_name"], group.Name);
            Assert.AreEqual(att["group_email"], group.Email);
            Assert.AreEqual(DateTime.Parse(att["group_end_free_trial"]), group.FreeTrialEndAt);
            Assert.AreEqual(att["company_name"], group.CompanyName);
            Assert.AreEqual(att["group_has_credit_card"].Equals("true"), group.HasCreditCard);

            Assert.AreEqual(att["group_currency"], group.Currency);
            Assert.AreEqual(TimeZoneConverter.fromOlsonTz(att["group_timezone"]), group.Timezone);
            Assert.AreEqual(att["group_country"], group.Country);
            Assert.AreEqual(att["group_city"], group.City);
        }