Example #1
0
        public virtual void ResetPin(string oldPin, string newPin)
        {
            var oldPinHash = GetPinHash(oldPin);

            if (Pin.Equals(oldPinHash, StringComparison.OrdinalIgnoreCase))
            {
                Pin = GetPinHash(newPin);
            }
        }
Example #2
0
		public void Equals ()
		{
			Pin pin1 = new Pin ();
			Pin pin2 = new Pin ();
			Pin pin3 = new Pin {
				Type = PinType.Place,
				Position = new Position (12, -24),
				Label = "Test",
				Address = "123 Test street"
			};

			Pin pin4 = new Pin {
				Type = PinType.Place,
				Position = new Position (12, -24),
				Label = "Test",
				Address = "123 Test street"
			};

			Assert.True (pin1.Equals (pin2));
			Assert.True (pin3.Equals (pin4));
			Assert.False (pin1.Equals (pin3));
		}
Example #3
0
        public void Equals()
        {
            Pin pin1 = new Pin();
            Pin pin2 = new Pin();
            Pin pin3 = new Pin {
                Type     = PinType.Place,
                Position = new Position(12, -24),
                Label    = "Test",
                Address  = "123 Test street"
            };

            Pin pin4 = new Pin {
                Type     = PinType.Place,
                Position = new Position(12, -24),
                Label    = "Test",
                Address  = "123 Test street"
            };

            Assert.True(pin1.Equals(pin2));
            Assert.True(pin3.Equals(pin4));
            Assert.False(pin1.Equals(pin3));
        }
Example #4
0
        internal static void UpdatePoll(long chatId, Pin pin)
        {
            if (!HasPoll(chatId))
            {
                throw new ArgumentException(nameof(chatId));
            }
            if (pin == null)
            {
                throw new ArgumentException(nameof(pin));
            }

            Poll poll = Polls[chatId];

            if (!pin.Equals(poll.Pin))
            {
                poll.ClearVotes();
            }
            poll.Pin = pin;
        }
Example #5
0
 public bool CheckPin(string pin)
 {
     return(Pin.Equals(GetPinHash(pin)));
 }