mardi 6 juin 2017

Testing In visual

I am new at testing. I don't really know how to create tests properly. I have the following method which creates a User. Can anyone please guide me how to create a test for this function. I will be very thankful

 public static void CreateUser(int userId,string name, System.DateTime createdAt,string createdBy, System.DateTime modifiedAt,
        string modifiedBy, string address,string city,string province, string country,string postcode, string phone)
    {
        using (UserDbContext _usermain = new UserDbContext())
        {
            User newuser = new User()
          {
               UserId = userId,
               Name = name,
               CreatedAt = createdAt,
               CreatedBy = createdBy,
               ModifiedBy = modifiedBy,
               ModifiedAt = modifiedAt,
               Address = address,
               City = city
         };
              _usermain.Users.Add(newuser);
               _usermain.SaveChanges();
        }

    }

Aucun commentaire:

Enregistrer un commentaire