Compare commits

..

No commits in common. 'c6fd28541b42b9814b916f4ce7da6a9baa84a758' and '1e4f846edb8e00b909851c1609d4f1ae48533a88' have entirely different histories.

@ -83,16 +83,7 @@ namespace Model.Dice
/// <exception cref="ArgumentNullException"></exception>
public Task<DiceGroup> Update(DiceGroup before, DiceGroup after)
{
var results= after.Dice.Where(dice => before.Dice.Contains(after.Dice[0]));
/* foreach(Die die in before.Dice)
{
if (after.Dice.Contains((die)))
{
throw new ArgumentException("the group of dice cannot be updated, only the name", nameof(before));
}
}*/
// pas autorisé de changer les dés, juste le nom
// pas autorisé de changer les dés, juste le nom
if (!before.Dice.SequenceEqual(after.Dice))
{
throw new ArgumentException("the group of dice cannot be updated, only the name", nameof(before));

@ -6,7 +6,7 @@ using System.Linq;
namespace Model.Dice
{
public abstract class Die:IEquatable<Die>
public abstract class Die
{
public ReadOnlyCollection<Face> Faces => new(faces);
@ -23,21 +23,6 @@ namespace Model.Dice
{
int faceIndex = rnd.Next(0, Faces.Count);
return Faces.ElementAt(faceIndex);
}
public bool Equals(Die other)
{
return Faces == other.Faces && Faces.SequenceEqual(other.Faces);
}
public override bool Equals(object obj)
{
if (obj is null) return false; // is null
if (ReferenceEquals(obj, this)) return true; // is me
if (!obj.GetType().Equals(GetType())) return false; // is different type
return Equals(obj as Die); // is not me, is not null, is same type : send up
}
}
}
}

@ -1,15 +1,11 @@
using System;
namespace Model.Dice.Faces
namespace Model.Dice.Faces
{
public abstract class Face
public abstract class Face
{
public string StringValue { get; protected set; }
public string StringValue { get; protected set; }
}
public abstract class Face<T> : Face, IEquatable<Face<T>>
public abstract class Face<T> : Face
{
public T Value { get; protected set; }
@ -17,15 +13,6 @@ namespace Model.Dice.Faces
{
Value = value;
StringValue = value.ToString();
}
public bool Equals(DiceGroup other)
{
return StringValue == other.Name;
}
}
}
}

@ -148,8 +148,7 @@ namespace Tests.Data_UTs.Dice
Xunit.Assert.DoesNotContain(toAdd2, await dgm.GetAll());
}
//To check sequence equal does not work properly
[Fact]
[Fact]//To check sequence equal does not work properly
public async Task TestUpdateWorksIfValid()
{
// Arrange

Loading…
Cancel
Save