Unit test insert/update/delete

前端 未结 3 1284
星月不相逢
星月不相逢 2021-01-04 21:27

I have googled this a little and didn\'t really find the answer I needed.

I am working on a webpage in C# with SQL Server and LINQ for a customer. I want the users

3条回答
  •  死守一世寂寞
    2021-01-04 22:10

    Have a fixtures file (in XML, SQL, YAML, whatever) that you can load into the local test database with just a command.

    E.g. a fixtures file for two users who need to message each other may look like (this is mine):

    Member:
    
      Member_WibWobble:
        username:       Wibble_Wobble
        email_address:  michael+dev_wibwob@[removed].com
        password:       pw
        is_super_admin: true
        last_login:     "2010-01-06 12:12:57"
        Country:        country_AU
        UploadImage:
          type:         
          upload:       "http://localhost/[removed]/images/wibwobble.jpg"
    
      Member_BunnyHugs:
        username:       BunnyHugs
        email_address:  michael+dev_bunny@[removed].com
        password:       pw
        is_super_admin: true
        last_login:     "2009-12-01 14:11:11"
        Country:        country_UK
        UploadImage:
          type:         
          upload:       "http://localhost/[removed]/images/bunnyhugs.jpg"
    
    PrivateMessage:
    
      PrivateMessage_1:
        subject:          "Yo"
        body:         |
          hi
    
          escape this html please
    
          bye
        is_read:          false
        Sender:           Member_WibWobble
        Recipient:        Member_BunnyHugs
    

提交回复
热议问题