You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notus/notus/Tests/Notus_UnitTest_Database/RemoveUserTests.cs

39 lines
1.0 KiB

using Biblioteque_de_Class;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Notus_UnitTest_Database
{
public class RemoveUserTests
{
private Database database;
[SetUp]
public void Setup()
{
database = new Database();
}
[Test]
public void RemoveUser_ExistingUser_UserRemovedFromList()
{
User user = new User("John","rien","choco");
user.SetEmail("john@example.com");
database.GetUserList().Add(user);
database.RemoveUser(user);
CollectionAssert.DoesNotContain(database.GetUserList(), user);
}
[Test]
public void RemoveUser_NonExistingUser_ThrowsException()
{
User user = new User("John", "rien", "choco");
user.SetEmail("john@example.com");
Assert.Throws<Exception>(() => database.RemoveUser(user), "User not found.");
}
}
}