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_Note/VerifyPrivilegeTests.cs

33 lines
1.1 KiB

using Biblioteque_de_Class;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Notus_UnitTest_Note
{
[TestFixture]
public class VerifyPrivilegeTests
{
[Test]
public void VerifyPrivilege_WhenUserIsEditor_ReturnsTrue()
{
User editor = new User("Editor1", "editor1@example.com", "password");
Note note = new Note("Test Note", "logo.png", new User("Owner", "owner@example.com", "password"));
note.AddEditor(note.GetOwner(), editor);
bool result = note.VerifyPrivilege(editor);
Assert.IsTrue(result);
}
[Test]
public void VerifyPrivilege_WhenUserIsNotEditor_ThrowsException()
{
User editor = new User("Editor1", "editor1@example.com", "password");
Note note = new Note("Test Note", "logo.png", new User("Owner", "owner@example.com", "password"));
bool result = note.VerifyPrivilege(editor);
Assert.IsFalse(result);
}
}
}