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.
49 lines
1.3 KiB
49 lines
1.3 KiB
using Model.Classes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace TestProject1
|
|
{
|
|
public class TestObjetOhara
|
|
{
|
|
[Fact]
|
|
public void ToString_ReturnsCorrectStringRepresentation()
|
|
{
|
|
var obj = new ObjetOhara("Objet 1", "image.png", true);
|
|
|
|
var result = obj.ToString();
|
|
|
|
Assert.True("ObjetOhara : Objet 1 True image.png"== result);
|
|
}
|
|
|
|
[Fact]
|
|
public void Equals_SameObject_ReturnsTrue()
|
|
{
|
|
var obj = new ObjetOhara("Objet 1");
|
|
var obj2 = new ObjetOhara("Objet 2");
|
|
var obj3 = new Bateau("Objet 3", "", 0, 0, "","");
|
|
var result = obj.Equals(obj);
|
|
var result2 = obj.Equals(obj2);
|
|
var result3 = obj.Equals(obj3);
|
|
Assert.True(result);
|
|
Assert.False(result2);
|
|
Assert.False(result3);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetHashCode_ObjectsWithSameProperties_ReturnsSameHashCode()
|
|
{
|
|
var obj1 = new ObjetOhara("Objet 1", "image.png", true);
|
|
var obj2 = new ObjetOhara("Objet 1", "image.png", true);
|
|
|
|
var hashCode1 = obj1.GetHashCode();
|
|
var hashCode2 = obj2.GetHashCode();
|
|
|
|
Assert.True(hashCode1==hashCode2);
|
|
}
|
|
}
|
|
}
|