public void Returns_String_Format_If_Object_Is_Not_Null() { // Arrange const string format = "[{0}]"; var value = Rnd.Str; // Act var result = StringF.Format(format, value, null); // Assert Assert.Equal(string.Format(format, value), result); }
public void Returns_IfNull_If_Object_Is_Null() { // Arrange object?obj = null; var format = Rnd.Str; var value = Rnd.Str; // Act var r0 = StringF.Format(format, obj, null); var r1 = StringF.Format(format, obj, value); // Assert Assert.Null(r0); Assert.Equal(value, r1); }
/// <inheritdoc cref="StringF.Format{T}(string, T)"/> public static string FormatWith <T>(this string @this, T source) => Modify(@this, () => StringF.Format(@this, source));