public void ShouldDeleteUser() { //arrange var user = GenerateUser(); //act var dataLayer = new DataLayer.Sql.DataLayer(ConnectionSql); dataLayer.AddUser(user); dataLayer.DeleteUser(user.Id); var resUser = dataLayer.GetUser(user.Id); //assert Assert.AreNotEqual(resUser.Id, user.Id); }
[TestMethod]//ok public void DeleteUserTest() { //arrange var user = new Users { //UserId = Guid.NewGuid(), Nickname = Guid.NewGuid().ToString().Substring(10), Username = Guid.NewGuid().ToString().Substring(10), Info = Guid.NewGuid().ToString().Substring(10) }; //act var dataLayer = new DataLayer.Sql.DataLayer(ConnectionString); user = dataLayer.AddUser(user); dataLayer.DeleteUser(user.UserId); var resultUser = dataLayer.GetUser(user.UserId); //asserts Assert.AreNotEqual(user.UserId, resultUser.UserId); }
public void ShouldAddGetDeleteUser() { //arrange var user = new User { UserName = "******" /*Guid.NewGuid().ToString()*/ }; //act var dataLayer = new DataLayer.Sql.DataLayer(_connectionString); var addUser = dataLayer.AddUser(user); var dataLayer1 = new DataLayer.Sql.DataLayer(_connectionString); var getUser = dataLayer1.GetUser(addUser.UserId); var dataLayer2 = new DataLayer.Sql.DataLayer(_connectionString); var isDeleted = dataLayer2.DeleteUser(getUser.UserId); //asserts Assert.AreEqual(addUser.UserId, getUser.UserId); Assert.AreEqual(addUser.UserName, getUser.UserName); Assert.IsNotNull(isDeleted); }