Dotnet CLI Komutları
  • Giriş
  • Genel Komutlar
    • dotnet
    • dotnet help
    • dotnet sdk check
  • Yüklü Proje Şablonları ile Proje Oluşturma Komutları
    • dotnet new sln
    • dotnet new classlib
    • dotnet new console
    • dotnet new web
    • dotnet new mvc
    • dotnet new webapi
    • dotnet new react
    • dotnet new angular
    • dotnet new grpc
    • dotnet new nunit
    • dotnet new xunit
    • dotnet new mstest
    • dotnet new gitignore
    • dotnet new globaljson
  • Proje Şablon İşlemleri için Komutlar
    • dotnet new list
    • dotnet new search
    • dotnet new install
    • dotnet new uninstall
    • dotnet new update
  • Proje Genel İşlemler için Komutlar
    • dotnet build
    • dotnet clean
    • dotnet publish
    • dotnet run
  • Çözüm (Solution) İşlemleri için Komutlar
    • dotnet sln add
    • dotnet sln remove
    • dotnet sln list
  • Proje Paket İşlemleri Komutları
    • dotnet add package
    • dotnet remove package
    • dotnet list package
  • Projeler Arası Referans Tanımlama Komutları
    • dotnet add reference
    • dotnet remove reference
    • dotnet list reference
  • Proje Sertifika Komutları
    • dotnet dev-certs https
  • Proje Test Komutları
    • dotnet test
  • Dotnet Araçları Genel Komutları
    • dotnet tool list
    • dotnet tool run
    • dotnet tool search
    • dotnet tool install
    • dotnet tool uninstall
    • dotnet tool update
  • Dotnet Code Generator Komutları
    • dotnet aspnet-codegenerator area
    • dotnet aspnet-codegenerator controller
    • dotnet aspnet-codegenerator view
  • Entity Framework Core Migrasyon Komutları
    • dotnet ef migrations add
    • dotnet ef migrations bundle
    • dotnet ef migrations list
    • dotnet ef migrations remove
    • dotnet ef migrations script
  • Entity Framework Core Veritabanı Komutları
    • dotnet ef database update
    • dotnet ef database drop
  • Entity Framework Core DbContext Komutları
    • dotnet ef dbcontext info
    • dotnet ef dbcontext list
    • dotnet ef dbcontext optimize
    • dotnet ef dbcontext scaffold
    • dotnet ef dbcontext script
Powered by GitBook
On this page
  • dotnet new nunit --help
  • dotnet new nunit --name <nunit_app_name> --output <output_directory>
  1. Yüklü Proje Şablonları ile Proje Oluşturma Komutları

dotnet new nunit

Dotnet core framework ile geliştirdiğimiz uygulamaları test edebiliyoruz. Framework bize test proje şablonları sunuyor.

Test proje şablonlarından ilki olan nunit proje şablonu ile bir test projesi oluşturarak geliştirdiğimiz uygulamalardaki en küçük birimleri test ederken yazdığımız unit testleri oluşturabiliyoruz.

İlk olarak --help opsiyonu ile komutumuzu inceleyelim.

dotnet new nunit --help

Komutu girdiğimizde karşımıza aşağıdaki gibi bir çıktı geliyor. Şimdi kullanacağımız opsiyonlara bakalım. Bunlar name ve output olacak.

--name opsiyonu ile uygulamaya verilecek ismi,

--output opsiyonu ile projenin oluşacağı dizinin yolunu belirleyebiliyoruz.

eg@debian:~$ dotnet new nunit --help
NUnit 3 Test Project (C#)
Author: Aleksei Kharlov aka halex2005 (codeofclimber.ru)
Description: A project that contains NUnit tests that can run on .NET on Windows, Linux and macOS

Usage:
  dotnet new nunit [options] [template options]

Options:
  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force                 Forces content to be generated even if it would change existing files.
  --no-update-check       Disables checking for the template package updates when instantiating a template.
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.

Template options:
  -f, --framework <net6.0|net7.0>  The target framework for the project.
                                   Type: choice
                                     net7.0  Target net7.0
                                     net6.0  Target net6.0
                                   Default: net7.0
  -p, --enable-pack                Whether or not to enable packaging (via ("dotnet pack") for the project.
                                   Type: bool
                                   Default: false
  --no-restore                     If specified, skips the automatic restore of the project on create.
                                   Type: bool
                                   Default: false

To see help for other template languages (F#, VB), use --language option:
   dotnet new nunit -h --language F#

dotnet new nunit --name <nunit_app_name> --output <output_directory>

Aşağıdaki çıktıdaki gibi komutu girdiğimizde ExampleSolution.NUnitApp1 adında /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.NUnitApp1 dizininde bir NUnit test projesi oluşmuş oluyor.

eg@debian:~$ dotnet new nunit --name ExampleSolution.NUnitApp1 --output /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.NUnitApp1
The template "NUnit 3 Test Project" was created successfully.

Processing post-creation actions...
Restoring /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.NUnitApp1/ExampleSolution.NUnitApp1.csproj:
  Determining projects to restore...
  Restored /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.NUnitApp1/ExampleSolution.NUnitApp1.csproj (in 5.6 sec).
Restore succeeded.
Previousdotnet new grpcNextdotnet new xunit

Last updated 1 year ago