public void WhenEncodingIsNotSet_ThenReturnUtf8()
            {
                var sut = new ClearPhrase("some phrase");

                Assert.That(sut.Encoding, Is.Not.Null);
                Assert.That(sut.Encoding, Is.TypeOf <UTF8Encoding>());
            }
            public void WhenEncodingSet_ThenReturnSetType()
            {
                var encoding = new ASCIIEncoding();

                var sut = new ClearPhrase("some phrase")
                {
                    Encoding = encoding
                };

                Assert.That(sut.Encoding, Is.SameAs(encoding));
            }
Example #3
0
            public void WhenCalledTwiceWithSamePhrase_ThenReturnEqualHashs()
            {
                var sut = CreateSut();

                var phrase = new ClearPhrase("Hello", "World", "Everyone!");

                var result1 = sut.Hash(phrase);
                var result2 = sut.Hash(phrase);

                Assert.That(result1, Is.EqualTo(result2));
            }
            public void WhenArgsAreValid_ThenSetProperties()
            {
                const string phrase = "phrase";
                const string salt   = "salt";
                const string pepper = "pepper";

                var sut = new ClearPhrase(phrase, salt, pepper);

                Assert.That(sut.Phrase, Is.EqualTo(phrase));
                Assert.That(sut.Salt, Is.EqualTo(salt));
                Assert.That(sut.Pepper, Is.EqualTo(pepper));
            }
 public void WhenPepperIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new ClearPhrase("phrase", "salt", null));
 }
 public void WhenPhraseIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new ClearPhrase(null));
 }