Exemplo n.º 1
0
        public void GetHashCode_should_return_the_same_value_as_another_instance_with_the_same_value()
        {
            var value1 = new PII("Test Value");
            var value2 = new PII("Test Value");

            value1.GetHashCode().Should().Be(value2.GetHashCode());
        }
Exemplo n.º 2
0
        public void GetHashCode_should_return_a_different_value_when_passed_another_instance_with_a_different_value()
        {
            var value1 = new PII("Test Value");
            var value2 = new PII("Test Value");

            value1.GetHashCode().Should().Be(value2.GetHashCode());
        }
Exemplo n.º 3
0
        public void Equals_should_return_false_when_passed_another_instance_with_a_different_value()
        {
            var value1 = new PII("Test Value");
            var value2 = new PII("Different Value");

            value1.Equals(value2).Should().BeFalse();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            PII pObj = new PII();

            pObj.KeyValuePairExample();
            Console.ReadLine();
        }
Exemplo n.º 5
0
        public void Equals_should_return_true_when_passed_another_instance_with_the_same_value()
        {
            var value1 = new PII("Test Value");
            var value2 = new PII("Test Value");

            value1.Equals(value2).Should().BeTrue();
        }
Exemplo n.º 6
0
        public void ToString_should_return_the_redacted_message_when_used_in_a_logger()
        {
            var logger      = new TestLogger <PIITests>(outputHelper);
            var valueObject = new PII(testValue);

            logger.LogInformation($"PII: {valueObject}");

            logger.Messages[0].Should().Be("PII: [Redacted]");
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var key    = PII.GenerateKey();
            var person = MakePerson();

            PrintPerson(person, "A PERSON MODEL", ConsoleColor.Red);
            person.Encrypt(key);
            PrintPerson(person, "ENCRYPTED PERSON", ConsoleColor.Green);
            person.Decrypt(key);
            PrintPerson(person, "DECRYPTED PERSON", ConsoleColor.Red);
        }
Exemplo n.º 8
0
 protected void GridResult_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         if (e.Row.Cells[3].Text == "PartI")
         {
             if (e.Row.Cells[5].Text == "Pass")
             {
                 PI += 1;
             }
             e.Row.BackColor = System.Drawing.Color.AntiqueWhite;
         }
         else if (e.Row.Cells[3].Text == "PartII")
         {
             if (e.Row.Cells[5].Text == "Pass")
             {
                 PII += 1;
             }
             e.Row.BackColor = System.Drawing.Color.Aquamarine;
         }
         else if (e.Row.Cells[3].Text == "SectionA")
         {
             if (e.Row.Cells[5].Text == "Pass")
             {
                 SA += 1;
             }
             e.Row.BackColor = System.Drawing.Color.AliceBlue;
         }
         else if (e.Row.Cells[3].Text == "SectionB")
         {
             if (e.Row.Cells[5].Text == "Pass")
             {
                 SB += 1;
             }
             e.Row.BackColor = System.Drawing.Color.LightCoral;
         }
     }
     lblPartICount.Text    = PI.ToString();
     lblPartIICount.Text   = PII.ToString();
     lblSectionACount.Text = SA.ToString();
     lblSectionBCount.Text = SB.ToString();
 }
Exemplo n.º 9
0
        public void Equals_should_return_false_when_passed_null()
        {
            var value1 = new PII(testValue);

            value1.Equals(null).Should().BeFalse();
        }
Exemplo n.º 10
0
        public void ToString_should_return_the_redacted_message()
        {
            var valueObject = new PII(testValue);

            valueObject.ToString().Should().Be("[Redacted]");
        }
Exemplo n.º 11
0
        public void SensitiveValue_should_return_the_sensitive_value()
        {
            var valueObject = new PII(testValue);

            valueObject.SensitiveValue.Should().Be(testValue);
        }