Example #1
0
        public void ShouldReturnTrueForTryParse()
        {
            // arrange
            var guidToParse = validIDAsString;

            // act
            var actual = PersonID.TryParse(guidToParse, out PersonID entityID);

            // assert
            Assert.IsTrue(actual);
        }
Example #2
0
        public void ShouldReturnDefaultEntityIdentifierForTryParse()
        {
            // arrange
            var idToParse = invalidIDAsString;
            var expected  = new PersonID();

            // act
            var success = PersonID.TryParse(idToParse, out PersonID actual);

            // assert
            Assert.AreEqual(expected, actual);
        }
Example #3
0
 public static bool TryParse(string value, out PersonID entityID)
 {
     if (GuidIdentifier.TryParse(value, out var id))
     {
         entityID = new PersonID(id);
         return(true);
     }
     else
     {
         entityID = new PersonID();
         return(false);
     }
 }
Example #4
0
        public void ShouldCreateEntityIDFromString()
        {
            // arrange
            var guid     = Guid.NewGuid();
            var expected = new PersonID(guid);

            var idToParse = guid.ToString();

            // act
            var actual = new PersonID(idToParse);

            // assert
            Assert.AreEqual(expected, actual);
        }