Ejemplo n.º 1
0
        /// <summary>Adds userStat.</summary>
        /// <param name="userStat">The user stat to add.</param>
		public void Add(UserStat userStat)
		{
			this.TimesRecommended += userStat.TimesRecommended;
			this.TimesFlowed += userStat.TimesFlowed;
			this.TimesPreviewed += userStat.TimesPreviewed;
			this.TimesPurchased += userStat.TimesPurchased;
		}
Ejemplo n.º 2
0
 /// <summary>Adds userStat.</summary>
 /// <param name="userStat">The user stat to add.</param>
 public void Add(UserStat userStat)
 {
     this.TimesRecommended += userStat.TimesRecommended;
     this.TimesFlowed      += userStat.TimesFlowed;
     this.TimesPreviewed   += userStat.TimesPreviewed;
     this.TimesPurchased   += userStat.TimesPurchased;
 }
Ejemplo n.º 3
0
        public void Can_serialize_empty_UserStat()
        {
            var userStat = new UserStat();
            var dtoStr   = TypeSerializer.SerializeToString(userStat);

            Assert.That(dtoStr, Is.EqualTo("\"00000000000000000000000000000000:0:0:0:0:0\""));

            SerializeAndCompare(userStat);
        }
Ejemplo n.º 4
0
        /// <summary>Parses.</summary>
        /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or
        /// illegal values.</exception>
        /// <param name="userStatString">The user stat string.</param>
        /// <returns>An UserStat.</returns>
		public static UserStat Parse(string userStatString)
		{
			var parts = userStatString.Split(':');
			if (parts.Length != 6)
				throw new ArgumentException("userStatString must have 6 parts");

			var i = 0;
			var userStat = new UserStat {
				UserId = new Guid(parts[i++]),
				TimesRecommended = int.Parse(parts[i++]),
				TimesPurchased = int.Parse(parts[i++]),
				TimesFlowed = int.Parse(parts[i++]),
				TimesPreviewed = int.Parse(parts[i++]),
			};
			return userStat;
		}
Ejemplo n.º 5
0
        /// <summary>Parses.</summary>
        /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or
        /// illegal values.</exception>
        /// <param name="userStatString">The user stat string.</param>
        /// <returns>An UserStat.</returns>
        public static UserStat Parse(string userStatString)
        {
            var parts = userStatString.Split(':');

            if (parts.Length != 6)
            {
                throw new ArgumentException("userStatString must have 6 parts");
            }

            var i        = 0;
            var userStat = new UserStat {
                UserId           = new Guid(parts[i++]),
                TimesRecommended = int.Parse(parts[i++]),
                TimesPurchased   = int.Parse(parts[i++]),
                TimesFlowed      = int.Parse(parts[i++]),
                TimesPreviewed   = int.Parse(parts[i++]),
            };

            return(userStat);
        }
Ejemplo n.º 6
0
		public void Can_serialize_empty_UserStat()
		{
			var userStat = new UserStat();
			var dtoStr = TypeSerializer.SerializeToString(userStat);

			Assert.That(dtoStr, Is.EqualTo("\"00000000000000000000000000000000:0:0:0:0:0\""));

			SerializeAndCompare(userStat);
		}