/// <inheritdoc />
        /// <summary>
        /// Overrides default Kentico behavior by allowing an alternative form named "upsert" to be used if
        /// forms named "insert", "update", or "newculture" do not exist.
        /// </summary>
        /// <param name="alternativeFormFullName">The provided name of the alternative form</param>
        /// <param name="useHashtable">Optional flag to use a hash table</param>
        /// <returns>An AlternativeFormInfo object</returns>
        protected override AlternativeFormInfo GetInfoByFullName(string alternativeFormFullName, bool useHashtable = true)
        {
            Guard.ArgumentNotNullOrEmpty(alternativeFormFullName, nameof(alternativeFormFullName));

            var providedForm = base.GetInfoByFullName(alternativeFormFullName, useHashtable);

            if (providedForm != null)
            {
                return(providedForm);
            }

            if (!AlternativeFormNameHelper.IsBuiltInPageTypeFormName(alternativeFormFullName))
            {
                return(null);
            }
            var upsertFormName = AlternativeFormNameHelper.CreateUpsertFullName(alternativeFormFullName);

            return(base.GetInfoByFullName(upsertFormName));
        }
 public void CreateUpsertFullName_ShouldThrow_ArgumentException()
 {
     Assert.That(() => AlternativeFormNameHelper.CreateUpsertFullName(string.Empty), Throws.TypeOf <ArgumentException>());
 }
        public void CreateUpsertFullName_Returns_Expected_Result(string altnernativeFormFullName, string expectedResult)
        {
            var result = AlternativeFormNameHelper.CreateUpsertFullName(altnernativeFormFullName);

            Assert.AreEqual(expectedResult, result);
        }