public void ShouldThrowArgumentNullExceptionOnceMarksIsNullAndFilterNonGoldenKeys() { var keysFilter = new KeysFilter(); var newKeysFilter = new NewKeysFilter(); var fakeSessionService = new FakeSessionServiceForNonGoldenKey(); keysFilter.GetType().GetProperty("SessionService", BindingFlags.NonPublic | BindingFlags.Instance) .SetValue(keysFilter, fakeSessionService); Assert.Throws <ArgumentNullException>(() => keysFilter.Filter(null, false)); Assert.Throws <ArgumentNullException>(() => newKeysFilter.Filter(null)); }
public void ShouldReturnEmptyKeysListWhenMarksAreNotEmpty() { var keysFilter = new KeysFilter(); var newKeysFilter = new NewKeysFilter(); var result = keysFilter.Filter(new List <string> { It.IsAny <string>() }, It.IsAny <bool>()); var newResult = newKeysFilter.Filter(new List <string> { It.IsAny <string>() }); Assert.Empty(result); Assert.Empty(newResult); }
public void ShouldReturnEmptyMarksWhenFilterWithEmptyMarks() { var keysFilter = new KeysFilter(); var fakeSessionService = new FakeSessionServiceForGoldenKey(); var newKeysFilter = new NewKeysFilter(); keysFilter.GetType().GetProperty("SessionService", BindingFlags.NonPublic | BindingFlags.Instance) .SetValue(keysFilter, fakeSessionService); var result = keysFilter.Filter(new List <string>(), It.IsAny <bool>()); var newResult = newKeysFilter.Filter(new List <string>()); Assert.Empty(result); Assert.Empty(newResult); }
public void TestNonGoldenKeys() { _sessionSerivce.Setup(x => x.Get <List <string> >("SilverKey")).Returns(_silverKeys); _sessionSerivce.Setup(x => x.Get <List <string> >("CopperKey")).Returns(_copperKeys); var keysFilter = new KeysFilter(_sessionSerivce.Object); var testData = new List <string>() { "SV01ABC001", "SV01ABC002", "SV04ABC005", "SV03ABC005FAKE", "CP02ABC001", "CP03ABC002", "CP01ABC006", }; var actual = keysFilter.Filter(testData, false); Assert.Equal(5, actual.Count); Assert.Equal("SV01ABC001", actual.First()); Assert.Equal("SV01ABC002", actual[1]); Assert.Equal("SV03ABC005FAKE", actual[2]); }
public void TestGoldenKeys() { _sessionSerivce.Setup(x => x.Get <List <string> >("GoldenKey")).Returns(_goldenKeys); var keysFilter = new KeysFilter(_sessionSerivce.Object); var testData = new List <string>() { "GD01ABC001", "GD02ABC002", "GD01ABC002", "GD02ABC004", "GD03ABC005", "GD03ABC006", "GD03ABC005FAKE" }; var actual = keysFilter.Filter(testData, true); Assert.Equal(5, actual.Count); Assert.Equal("GD01ABC001", actual.First()); Assert.Equal("GD02ABC002", actual[1]); Assert.Equal("GD01ABC002", actual[2]); Assert.Equal("GD03ABC005FAKE", actual.Last()); }
public void ShouldReturnEmptyListWhenMarksIsNull() { var result = _keysFilter.Filter(null, true); Assert.True(result.Count == 0); }