public void ContentNaming_IncrementNameSuffix()
{
string msg;
msg = IncrementNameSuffixTest("Car", "Car(1)"); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("Car(12)", "Car(13)"); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("Car.xml", "Car(1).xml"); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("Car(8).xml", "Car(9).xml"); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("Car((8).xml", "Car((9).xml"); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("(1)", "(2)"); Assert.IsNull(msg, msg); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest(")", ")(1)"); Assert.IsNull(msg, msg); Assert.IsNull(msg, msg);
msg = IncrementNameSuffixTest("Car(string)(12)", "Car(string)(13)"); Assert.IsNull(msg, msg);
// suffices are guids for the following.
// if the last suffixed name from db is in the form 'name(x)' where x is not a number, we are not able to decide the next suffix, so it is guid
string nameBase;
var actual = ContentNamingHelper.IncrementNameSuffix("Car(string)", out nameBase);
Assert.IsTrue(SuffixIsGuid(actual));
actual = ContentNamingHelper.IncrementNameSuffix("Car(8)).xml", out nameBase);
Assert.IsTrue(SuffixIsGuid(actual));
actual = ContentNamingHelper.IncrementNameSuffix("Car()", out nameBase);
Assert.IsTrue(SuffixIsGuid(actual));
}
[TestMethod]