public static void Converting_Hello_To_A_Udi_Returns_False() { // Arrange Udi.ResetUdiTypes(); const string sample = "Hello"; // Act bool success = UmbracoHelper.ConvertIdObjectToUdi( sample, out Udi result ); // Assert Assert.IsFalse(success); Assert.That(result, Is.Null); }
public static void Converting_Boxed_Udi_To_A_Udi_Returns_Original_Udi_Value() { // Arrange UdiParser.ResetUdiTypes(); Udi sample = new GuidUdi(Constants.UdiEntityType.AnyGuid, Guid.NewGuid()); // Act bool success = UmbracoHelper.ConvertIdObjectToUdi( sample, out Udi result ); // Assert Assert.IsTrue(success); Assert.That(result, Is.EqualTo(sample)); }
public static void Converting_string_udi_to_a_udi_returns_original_udi_value() { // Arrange Udi.ResetUdiTypes(); Udi sample = new GuidUdi(Constants.UdiEntityType.AnyGuid, Guid.NewGuid()); // Act bool success = UmbracoHelper.ConvertIdObjectToUdi( sample.ToString(), out Udi result ); // Assert Assert.IsTrue(success, "Conversion of UDI failed."); Assert.That(result, Is.EqualTo(sample)); }
public static void Converting_Unsupported_Object_To_A_Udi_Returns_False() { // Arrange UdiParser.ResetUdiTypes(); var clearlyWillNotConvertToGuid = new StringBuilder(0); // Act bool success = UmbracoHelper.ConvertIdObjectToUdi( clearlyWillNotConvertToGuid, out Udi result ); // Assert Assert.IsFalse(success); Assert.That(result, Is.Null); }
public void Converting_String_Udi_To_A_Udi_Returns_Original_Udi_Value() { // Arrange SetUpDependencyContainer(); UdiParser.ResetUdiTypes(); Udi sample = new GuidUdi(Constants.UdiEntityType.AnyGuid, Guid.NewGuid()); // Act bool success = UmbracoHelper.ConvertIdObjectToUdi( sample.ToString(), out Udi result ); // Assert Assert.IsTrue(success, "Conversion of UDI failed."); Assert.That(result, Is.EqualTo(sample)); }