Generating realistic fake data in .NET using Bogus

Поділитися
Вставка
  • Опубліковано 6 лип 2020
  • Become a Patreon and get source code access: / nickchapsas
    Check out my courses: dometrain.com
    Hello everybody I'm Nick and in this .NET tutorial I will show you how you can generate unlimited realistic looking fake data using a Nuget package called Bogus. Bogus is an open source project and it supports multiple locales so it will definitely have something useful for you.
    Give Bogus a star: github.com/bchavez/Bogus
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: bit.ly/ChapsasGitHub
    Follow me on Twitter: bit.ly/ChapsasTwitter
    Connect on LinkedIn: bit.ly/ChapsasLinkedIn
    #dotnet #data #bogus

КОМЕНТАРІ • 32

  • @williambell4591
    @williambell4591 3 роки тому

    Thanks for this - very apropos for me! Never heard of this package until now! Thanks!

  • @zoltan.halasz
    @zoltan.halasz 4 роки тому +5

    I like your channel and topics for .net. this is also an interesting one!

  • @vamsi8669
    @vamsi8669 4 роки тому +2

    Your videos and content is invaluable. Thanks

  • @ceralguy85
    @ceralguy85 4 роки тому +3

    Great video, this would help me to test simple apis on net core.

  • @ahmeddan7734
    @ahmeddan7734 4 роки тому +1

    Thanks. Great one

  • @romanhrytskiv8845
    @romanhrytskiv8845 4 роки тому +1

    Nice one, thanks!

  • @standman007
    @standman007 4 роки тому +1

    Thank you Thank you!!

  • @recepdmr_
    @recepdmr_ 4 роки тому +1

    Thanks for video.

  • @justwatching6118
    @justwatching6118 2 роки тому

    Interesting, thank you! :)

  • @jerryjeremy4038
    @jerryjeremy4038 4 роки тому +1

    Good share. Thanks

  • @yeisonbernal1219
    @yeisonbernal1219 3 роки тому +1

    Thanks for the video! really useful, i have a question, i am generating countrys whith name and CountryCode ISO 33166. All the 245 that exist, but as it is randomly generated, repeted countrys apear. how can i avoid repeted country names and country codes using The faker (Address.Country and Address.CountryCode) ?

  • @steveidowu906
    @steveidowu906 3 роки тому

    This is cool!

  • @msayeed78
    @msayeed78 3 роки тому

    Super!

  • @mohammedhayder3776
    @mohammedhayder3776 4 роки тому

    can you please talk about background services in dotnet core?

  • @MarkMorganLancaster
    @MarkMorganLancaster Рік тому

    Bravo Poly😀

  • @cavalfou
    @cavalfou 2 роки тому

    Hey, is there a way to have coherent address like not having an American Lake in the Country Reunion for example?

  • @aliwa91
    @aliwa91 4 роки тому +1

    think you

  • @PaulNicholsAUS
    @PaulNicholsAUS 3 роки тому +2

    Hi Nick I haven’t watched the video yet but do you know how this compares with Autofixture which I use?

    • @nickchapsas
      @nickchapsas  3 роки тому +1

      If you want realistic looking data then it’s better

    • @kj2w
      @kj2w 2 роки тому +3

      Bogus, to me, is used for generating real looking data that I need to read. Something I would use to seed my Local/QA/Test database(es) and then display in a UI.
      AutoFixture I've used in unit tests where I wanted complex objects but don't necessarily need properties to be readable.
      Example, for property Firstname, Bogus would create a string of "Sally", "Kevin" or "Nick". Whereas AutoFixture would create a string of "Firstname_9b003ae7-f6e6-45c8-836a-e8d1c4d6c403', 'Firstname_3f739a19-8b61-4214-b628-2cae4cb6f31d', or 'Firstname_dea11d42-9cff-44b3-94e2-5192c09eb110'.
      My unit test for Firstname just cares that its a string, not necessarily the contents of the property.

  • @ronaldoperes1202
    @ronaldoperes1202 Рік тому +1

    What about Autofixture?

  • @cloudsty452
    @cloudsty452 4 роки тому

    What's the comparison between Bogus and GenFu. GenFu pretty much does the same

  • @terencetcf
    @terencetcf 3 роки тому

    I wonder if you can use it to fake 2 objects that are related. For example, you have entity & dto class and you want to fake both with same data, then I can test a mapper logic to make sure the return dto has the correct mappings.

    • @izobrr
      @izobrr 2 роки тому

      In this case you need to populate one object, then map it manually to the other object and compare this with what your mapper returns. Or, maybe you want to test your mapper, but there is other way to map these objects which you can trust. For example serialize one object to json and deserialize as another object. Then again you populate one object and compare your mapper with this method.

    • @terencetcf
      @terencetcf 2 роки тому

      @@izobrr what I meant is using the faker instead of doing it manually. Almost: var objectToMap = new faker(); var mappedDto = mapper(objectToMap); var expected = new faker(); mappedDto.shouldBeEquivalentTo(expected);

  • @MaxLaurieHutchinson
    @MaxLaurieHutchinson 2 роки тому

    I love bogus!

  • @brentsteyn6671
    @brentsteyn6671 3 роки тому

    It would be cool if it could generate the values automatically. Maybe I should write something like that 🤔

  • @viliuxsas
    @viliuxsas Рік тому

    How to quickly populate in Visual Studio 2022 like 5:50 ?