public void Given_Value_Set_When_I_Call_GetLastUpdatedDateTime_Then_The_Correct_Value_Is_Returned() { //arrange const string serverParkName = "LocalDevelopment"; const string instrumentName = "OPN2102R"; const string dateValue = "02-12-2021"; const string timeValue = "09:23:59"; var lastUpdated = DateTime.ParseExact($"{dateValue} {timeValue}", "dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); var fieldData = new Dictionary <string, string> { { FieldNameType.HOut.FullName(), "110" }, { FieldNameType.TelNo.FullName(), "07000000000" }, { FieldNameType.LastUpdatedDate.FullName(), dateValue }, { FieldNameType.LastUpdatedTime.FullName(), timeValue } }; _sut.CreateCase(_primaryKey, fieldData, instrumentName, serverParkName); //act var dataRecord = _sut.GetCase(_primaryKey, instrumentName, serverParkName); var result = _sut.GetLastUpdated(dataRecord); //arrange Assert.AreEqual(lastUpdated, result); //cleanup _sut.RemoveCase(_primaryKey, instrumentName, serverParkName); }
public void Given_Valid_Arguments_When_I_Call_Update_An_Existing_Case_Then_The_Case_Is_Updated() { //arrange const string serverParkName = "LocalDevelopment"; const string instrumentName = "OPN2101A"; var fieldData = new Dictionary <string, string> { { FieldNameType.HOut.FullName(), "110" }, { FieldNameType.TelNo.FullName(), "07000000000" } }; _sut.CreateCase(_primaryKey, fieldData, instrumentName, serverParkName); fieldData[FieldNameType.TelNo.FullName()] = "0711111111"; var existingCase = _sut.GetCase(_primaryKey, instrumentName, serverParkName); //act _sut.UpdateCase(existingCase, fieldData, instrumentName, serverParkName); existingCase = _sut.GetCase(_primaryKey, instrumentName, serverParkName); var fields = _sut.GetRecordDataFields(existingCase); //arrange Assert.AreEqual("0711111111", fields[FieldNameType.TelNo.FullName()]); //cleanup _sut.RemoveCase(_primaryKey, instrumentName, serverParkName); }
[Test] public void Given_Valid_Arguments_When_I_Call_RemoveCases_Then_Then_All_Cases_Are_Deleted() { //arrange const string serverParkName = "LocalDevelopment"; const string instrumentName = "OPN2101A"; var primaryKey = 9000001; var fieldData = new Dictionary <string, string> { { FieldNameType.HOut.FullName(), "110" }, { FieldNameType.TelNo.FullName(), "07000000000" } }; for (var i = 0; i < 1000; i++) { _sut.CreateCase(primaryKey.ToString(), fieldData, instrumentName, serverParkName); primaryKey++; } //act _sut.RemoveCases(instrumentName, serverParkName); var result = _sut.GetNumberOfCases(instrumentName, serverParkName); //arrange Assert.AreEqual(0, result); }
public void Given_A_Case_Exists_When_I_Call_CaseExists_Then_True_Is_Returned() { //arrange const string serverParkName = "LocalDevelopment"; const string instrumentName = "OPN2101A"; var fieldData = new Dictionary <string, string> { { FieldNameType.HOut.FullName(), "110" }, { FieldNameType.TelNo.FullName(), "07000000000" } }; _sut.CreateCase(_primaryKey, fieldData, instrumentName, serverParkName); //act var result = _sut.CaseExists(_primaryKey, instrumentName, serverParkName); //assert Assert.IsTrue(result); //cleanup _sut.RemoveCase(_primaryKey, instrumentName, serverParkName); }
private static void CreateCases(int numberOfCases, string instrumentName, string serverParkName) { var blaiseCaseApi = new BlaiseCaseApi(); var primaryKey = 90000; for (var count = 0; count < numberOfCases; count++) { var dictionary = new Dictionary <string, string> { { "serial_number", primaryKey.ToString() } }; blaiseCaseApi.CreateCase(primaryKey.ToString(), dictionary, instrumentName, serverParkName); primaryKey++; } }
public void Given_Valid_Arguments_When_I_Call_GetCase_Then_The_Case_is_Returned() { //arrange const string serverParkName = "LocalDevelopment"; const string instrumentName = "OPN2102R"; var fieldData = new Dictionary <string, string> { { FieldNameType.HOut.FullName(), "110" }, { FieldNameType.TelNo.FullName(), "07000000000" } }; _sut.CreateCase(_primaryKey, fieldData, instrumentName, serverParkName); //act var result = _sut.GetCase(_primaryKey, instrumentName, serverParkName); //arrange Assert.AreEqual(_primaryKey, _sut.GetPrimaryKeyValue(result)); //cleanup _sut.RemoveCase(_primaryKey, instrumentName, serverParkName); }