コード例 #1
0
        public void MapToPlatformUsageEnum_FromString_ExpectedResult(string input, PlatformUsage expectedResult)
        {
            // Arrange + Act
            var result = input.MapToPlatformUsageEnum();

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
コード例 #2
0
        public void MapToString_FromPlatformUsageEnum_ExpectedResult(PlatformUsage input, string expectedResult)
        {
            // Arrange + Act
            var result = input.MapToString();

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
コード例 #3
0
        /// <summary>
        /// Maps the <see cref="PlatformUsage"/> to its corresponding Tikkie API string.
        /// </summary>
        /// <param name="platformUsage">The platform usage as enum.</param>
        /// <returns>The platform usage in string format.</returns>
        /// <exception cref="ArgumentException">When the platform usage enum is not recognized.</exception>
        public static string MapToString(this PlatformUsage platformUsage)
        {
            switch (platformUsage)
            {
            case PlatformUsage.PaymentRequestForMyself: return("PAYMENT_REQUEST_FOR_MYSELF");

            case PlatformUsage.PaymentRequestForOthers: return("PAYMENT_REQUEST_FOR_OTHERS");

            default: throw new ArgumentException($"Not recognized {nameof(platformUsage)}");
            }
        }