public void AddPosition(DTOPosition position) { string error; if (Position.DoesPositionNameExist(position, Positions, out error)) { ThrowError(error); return; } positionListFeedBack.AddPosition(position); }
public void DoesPositionNameExist_DTOList() { var position1 = new DTOPosition(1, "1", "1"); var position2 = new DTOPosition(2, "2", "2"); var dTOposition = new DTOPosition(3, "2", "2"); var positions = new List <DTOPosition>() { position1, position2 }; var result = Position.DoesPositionNameExist(dTOposition, positions, out var error); Assert.IsTrue(result); Assert.AreEqual($"Name {dTOposition.Name} is already taken", error); }