Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Commit 184e49f

Browse files
authored
Merge pull request #123 from Standaard-boos/TreeAgeBugFix
Bugfix?
2 parents da9c406 + 6b5e5f2 commit 184e49f

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

ViewModel.Test/ViewModel_MainDecisiontree_GetListReturned.cs renamed to ViewModel.Test/ViewModel_Decisiontree_GetListReturned.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Text;
45
using Model;
56
using NuGet.Frameworks;
67
using NUnit.Framework;
78

89
namespace ViewModel.Test
910
{
10-
public class ViewModel_MainDecisiontree_GetListReturned
11+
public class ViewModel_Decisiontree_GetListReturned
1112
{
1213
[SetUp]
1314
public void Setup()
1415
{
1516
InitialSetupForTests.ClearFieldsInAccount();
16-
Account.Email = "test@mail.com";
17+
Account.Email = "UnitTest1@windesheim.nl";
1718
Account.Authenticated = true;
18-
Account.UserID = 1;
19+
Account.UserID = 176;
1920
}
2021

2122

@@ -25,5 +26,15 @@ public void GetListOfPotentialMatches_NotNull()
2526
var result = Helpers.Decisiontree.MainDecisionTree.GetProfilesBasedOnIntrestAndNormsAndValues(Account.UserID.Value);
2627
Assert.NotNull(result);
2728
}
29+
30+
31+
[Test]
32+
public void AccountUnitTestInTopList()
33+
{
34+
Helpers.Decisiontree.MainDecisionTree.GetProfilesBasedOnIntrestAndNormsAndValues(Account.UserID.Value);
35+
var result = Helpers.Decisiontree.MainDecisionTree.BestMatch;
36+
Assert.That(result.Any(p => p.LastName.Equals("Test2")));
37+
Assert.That(result.Any(p => p.LastName.Equals("Test3")));
38+
}
2839
}
2940
}

ViewModel/Helpers/Decisiontree/Methodes/SameAgeCheck.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static bool CheckSameAge(Profile pf, Profile liupf)
3434
/// <returns>true or false</returns>
3535
private static bool CheckAge(Profile pf, Profile liupf)
3636
{
37-
if (String.IsNullOrEmpty(pf.Age))
37+
if (String.IsNullOrEmpty(pf.Age) || String.IsNullOrEmpty(liupf.Age))
3838
{
3939
return false;
4040
}

ViewModel/Helpers/Decisiontree/Methodes/SameSchoolCheck.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public static class SameSchoolCheck
1616
public static bool CheckSameSchool(School pfSchool , School logedInUserSchool)
1717
{
1818

19-
if (pfSchool == null)
19+
if (logedInUserSchool == null || pfSchool == null)
2020
{
2121
return false;
2222
}
2323

24-
if (pfSchool.SchoolName.Equals(logedInUserSchool.SchoolName))
24+
if (pfSchool.SchoolName == logedInUserSchool.SchoolName)
2525
{
2626
MainDecisionTree.Score += 5;
2727
return true;

0 commit comments

Comments
 (0)