コード例 #1
0
        private static string GetCommentName(TemplateDescription desc, Authentication authentication, Calls calls, bool hosted)
        {
            string authenticationText = GetText(authentication);

            if (!string.IsNullOrEmpty(authenticationText))
            {
                authenticationText = ", " + authenticationText;
            }
            else
            {
                authenticationText = ", no auth";
            }

            string callsText;

            if (calls == Calls.NoDownstreamApi)
            {
                callsText = string.Empty;
            }
            else
            {
                callsText = GetText(calls);
            }
            string hostedText = GetText(hosted);
            string comment    = $"{desc.Template}{authenticationText}{hostedText}{callsText}".ToLowerInvariant();

            return(comment);
        }
コード例 #2
0
        public static IEnumerable <bool> GetPossibleHosted(TemplateDescription templateDescription, Authentication authentication)
        {
            yield return(false);

            if (templateDescription.Template == "blazorwasm2" && (authentication == Authentication.SingleOrg || authentication == Authentication.B2C))
            {
                yield return(true);
            }
        }
コード例 #3
0
        public static IEnumerable <Calls> GetPossibleCalls(TemplateDescription templateDescription, Authentication authentication, bool hosted)
        {
            yield return(Calls.NoDownstreamApi);

            if (authentication == Authentication.SingleOrg || authentication == Authentication.B2C && (templateDescription.Template != "blazorwasm2" || hosted))
            {
                if (authentication != Authentication.B2C)
                {
                    yield return(Calls.CallsGraph);
                }
                yield return(Calls.CallsWebApi);
            }
        }
コード例 #4
0
        private static void GenerateSampleCreation(TemplateDescription desc, Authentication authentication, Calls calls, bool hosted)
        {
            Console.WriteLine($"echo \"Test {GetCommentName(desc, authentication, calls, hosted)}\"");
            string folder = GetFolderName(desc, authentication, calls, hosted);

            Console.WriteLine($"mkdir {folder}");
            Console.WriteLine($"cd {folder}");
            Console.WriteLine($"dotnet new {desc.Template} {GetFlags(authentication)} {GetFlags(calls, authentication)} {GetFlags(hosted)}");
            if (hosted)
            {
                Console.WriteLine($@"dotnet sln ..\..\tests.sln add Shared\{folder}.Shared.csproj");
                Console.WriteLine($@"dotnet sln ..\..\tests.sln add Server\{folder}.Server.csproj");
                Console.WriteLine($@"dotnet sln ..\..\tests.sln add Client\{folder}.Client.csproj");
            }
            else
            {
                Console.WriteLine($@"dotnet sln ..\..\tests.sln add {folder}.csproj");
            }
            Console.WriteLine("cd ..");
            Console.WriteLine();
        }
コード例 #5
0
        private static string GetFolderName(TemplateDescription desc, Authentication authentication, Calls calls, bool hosted)
        {
            string authenticationText = Enum.GetName(typeof(Authentication), authentication);

            if (!string.IsNullOrEmpty(authenticationText))
            {
                authenticationText = "-" + authenticationText;
            }

            string callsText;

            if (calls == Calls.NoDownstreamApi)
            {
                callsText = string.Empty;
            }
            else
            {
                callsText = "-" + Enum.GetName(typeof(Calls), calls);
            }
            string hostedText = hosted ? "-hosted" : string.Empty;
            string folder     = $"{desc.Template}{authenticationText}{callsText}{hostedText}".ToLowerInvariant();

            return(folder);
        }