public void TestRequestNotFulfilledCheckFalse() { int requested = 5; var result = PinGeneratorHelper.RequestNotFulfilled(requested, new List <PIN>(new PIN[requested])); Assert.IsFalse(result); }
public void TestAllPossiblePINs() { int expectedReturnPins = possiblePins; var result = PinGeneratorHelper.GetAllPossiblePins(); Assert.AreEqual(result.Count(), expectedReturnPins); }
public void TestAllPINsCreation() { int expectedReturnPins = validPins; var result = PinGeneratorHelper.GetAllPINs(); Assert.AreEqual(result.Count, expectedReturnPins); }
/// <summary> /// Queries the DataStore for the specified number of randomly selected PINs and ensures allocation is reset when necessary. /// </summary> /// <param name="requested">The number of PINs requested by the user.</param> /// <returns>A list of PIN objects equal in length to the requested number.</returns> public async Task <IReadOnlyList <PIN> > GetPINs(int requested) { IReadOnlyList <PIN> pins = new List <PIN>(); pins = await PinGeneratorHelper.HandlePINRetrieval(unitOfWork, requested, pins); return(pins); }
public async Task TestFirstTimeGeneration() { unitOfWorkMock.Setup(mock => mock.Pins.AddPins(It.IsAny <DataTable>())).Returns(Task.FromResult(true)); var result = await PinGeneratorHelper.FirstTimePinGenerationAsync(unitOfWorkMock.Object); Assert.IsTrue(result); }
public void TestSequentialFlagFalse() { var result = PinGeneratorHelper.IsSequential("4576"); Assert.IsFalse(result); result = PinGeneratorHelper.IsSequential("7645"); Assert.IsFalse(result); }
public void TestConvertPinListToDataTable() { int requested = 5; List <PIN> pins = new List <PIN>(new PIN[requested]); var result = PinGeneratorHelper.ConvertToDataTable(pins); Assert.AreEqual(pins.Count, result.Rows.Count); }
/// <summary> /// Tests if PINs have been initialized and initializes them if not. /// </summary> /// <returns>A boolean value indicating whether initialisation has succeeded.</returns> public async Task <bool> InitializePins() { if (await unitOfWork.Pins.IsInitialized()) { return(true); } return(await PinGeneratorHelper.FirstTimePinGenerationAsync(unitOfWork)); }
public void TestSequentialFlagTrue() { var result = PinGeneratorHelper.IsSequential("4567"); Assert.IsTrue(result); result = PinGeneratorHelper.IsSequential("7654"); Assert.IsTrue(result); }
public async Task TestAddPINsWithInitialList() { int requested = 5; IReadOnlyList <PIN> pins = new List <PIN>(new PIN[requested]); unitOfWorkMock.Setup(mock => mock.Pins.GetPINs(requested)).Returns(Task.FromResult(pins)); var result = await PinGeneratorHelper.AddPINsFromDataStore(unitOfWorkMock.Object, requested, pins); Assert.AreEqual(result.Count, requested * 2); }
public async Task TestHandlePINRetrievalNoRollover() { int requested = 5; IReadOnlyList <PIN> pins = new List <PIN>(new PIN[requested]); unitOfWorkMock.Setup(mock => mock.Pins.GetPINs(requested)).Returns(Task.FromResult(pins)); var result = await PinGeneratorHelper.HandlePINRetrieval(unitOfWorkMock.Object, requested, new List <PIN>()); Assert.AreEqual(result.Count, requested); }
public void TestMapPINStringsToObjectList() { List <string> pinStrings = new List <string> { "0000", "1111", "5453" }; var result = PinGeneratorHelper.MapToPINList(pinStrings); Assert.AreEqual(result.Count(), pinStrings.Count()); Assert.AreEqual(result.First().Allocated, false); Assert.AreEqual(result.First().PinString, pinStrings.First()); Assert.AreEqual(result.Last().PinString, pinStrings.Last()); }
public void TestIsValidPINFlagFalse() { var result = PinGeneratorHelper.IsValidPin("5555"); Assert.IsFalse(result); }
public void TestPalindromeFlagTrue() { var result = PinGeneratorHelper.IsPalindromic("9779"); Assert.IsTrue(result); }
public void TestYearFlagTrue() { var result = PinGeneratorHelper.IsLogicalYear("1986"); Assert.IsTrue(result); }
public void TestRepeatFlagFalse() { var result = PinGeneratorHelper.ContainsRepeat("5364"); Assert.IsFalse(result); }
public void TestRepeatFlagTrue() { var result = PinGeneratorHelper.ContainsRepeat("4343"); Assert.IsTrue(result); }
public void TestPairFlagFalse() { var result = PinGeneratorHelper.ContainsPairs("1342"); Assert.IsFalse(result); }
public void TestPairFlagTrue() { var result = PinGeneratorHelper.ContainsPairs("1122"); Assert.IsTrue(result); }
public void TestPalindromeFlagFalse() { var result = PinGeneratorHelper.IsPalindromic("9775"); Assert.IsFalse(result); }
public void TestYearFlagFalse() { var result = PinGeneratorHelper.IsLogicalYear("5434"); Assert.IsFalse(result); }
public void TestIsValidPINFlagTrue() { var result = PinGeneratorHelper.IsValidPin("6442"); Assert.IsTrue(result); }