public void GetJsonColumnFromStoredProcedure(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); Output.WriteLine($"Db instance name: {InstanceName}"); var spName = jsonTestCase.GetObject <string>("SpName"); var colorName = jsonTestCase.GetObject <string>("ColorName"); dynamic expected = JToken.Parse( JToken.Parse(jsonTestCase.GetObject <string>("Expected")) .SelectToken("Json") .ToString()) .ToObject <dynamic>(); var expectedRgb = new { expected.Red, expected.Green, expected.Blue }; dynamic actual = JToken.Parse(HttpClient.Get <string>($"api/hsl/json?spName={spName}&colorName={colorName}") .GetObject <string>()) .ToObject <dynamic>(); var actualRgb = new { actual.Red, actual.Green, actual.Blue }; Assert.Equal(expectedRgb, actualRgb); }
public void Update(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var input = jsonTestCase.GetObject <Color>("Input"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); var expectedHistory = jsonTestCase.GetObject <List <Color> >("ExpectedHistory") .OrderByDescending(x => x.SysStart); Repo.Update(input, id); var actual = Repo.Query.ToPagedList() .OrderBy(x => x.Id); /* * var wholeHistory = Repo.QueryAsOf( * new System.DateTime(2015, 7, 1), * new System.DateTime(2017, 7, 1), * x => x.Name.Contains("e"), * 1, 10000, * asc=>asc.Id, desc=>desc.SysStart).ToList(); * */ var actualHistory = Repo.GetByIdHistory(id) .OrderByDescending(x => x.SysStart); Assert.True(actual.IsEqualOrWrite(expected, Output)); Assert.True(actualHistory.IsEqualOrWrite(expectedHistory, Output)); }
public void TestJsonB_GetData(string t, JsonTestCase jsonTestCase) { _output.WriteLine($"Test case: {t}"); var input = jsonTestCase.GetObject <string>("Input"); var expected = jsonTestCase.GetObject <string[]>("Expected"); var actual = mockActualB[input]; Assert.Equal(expected, actual); }
public void Excel(string t, JsonTestCase jsonTestCase) { _output.WriteLine($"Test case: {t}"); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <Person>("Expected"); Assert.Equal(_input[jsonTestCase.TestCase], input); Assert.Equal(_expected[jsonTestCase.TestCase].FirstName, expected.FirstName); }
public void GetByIdEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Employee>("Expected"); var actual = Repo.GetById(id); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public async Task ExistsAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <bool>("Expected"); var actual = await Repo.ExistsAsync(id); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public async Task GetByIdAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <Color>("Expected"); var actual = await Repo.GetByIdAsync(input); Assert.True(actual.IsEqualOrWrite(expected, 2, PROPS_FILTER, Output)); }
public void Get_Forward(string t, JsonTestCase jsonTestCase) { Output.WriteLine($"Instance Name:{InstanceName}"); Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Color>("Expected"); var actual = HttpClient.Get <Color>($"api/color/forward?id={id}").Value; Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void DeleteAndGetMultipleEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <List <Employee> >("Expected"); Repo.Delete(id); var actual = Repo.Query.OrderBy(e => e.Id).ToList(); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void GetByIdAsOf(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var asOf = jsonTestCase.GetObject <DateTime>("AsOf"); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Color>("Expected"); var actual = Repo.GetByIdAsOf(asOf, id); Assert.True(actual.IsEqualOrWrite(expected, 2, PROPS_FILTER, Output)); }
public void GetLastCheck(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <AgencyInvestigatorCheck>("Expected"); var actual = Repo.GetLastCheck(input); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public void GetLastCheck(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <StateBackgroundCheckView>("Expected"); var actual = Repo.GetLastCheck(input); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public void GetEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); Output.WriteLine($"Db instance name: {InstanceName}"); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Employee>("Expected"); var actual = HttpClient.Get <Employee>($"api/employee/{id}").Value; Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public void Get(string t, JsonTestCase jsonTestCase) { Output.WriteLine($"Instance Name:{InstanceName}"); Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Color>("Expected"); var actual = ApiClient.GetColor(id).Object <Color>(); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void GetAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); Output.WriteLine($"Db instance name: {InstanceName}"); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <Rgb>("Expected"); var actual = HttpClient.Get <Rgb>($"api/rgb/async/{id}") .GetObject <Rgb>(); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public async Task UpdateAndGetAsyncEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var input = jsonTestCase.GetObject <Employee>("Input"); var expected = jsonTestCase.GetObject <Employee>("Expected"); Repo.Update(input, id); var actual = await Repo.GetByIdAsync(id); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void Sqlite(string t, JsonTestCase jsonTestCase) { _output.WriteLine($"Test case: {t}"); var input = jsonTestCase.GetObject <int>("Input", _output); var missingParam = jsonTestCase.GetObjectOrDefault <string>("Optional", _output); var expected = jsonTestCase.GetObject <Person>("Expected", _output); Assert.Equal(_input[jsonTestCase.TestCase], input); Assert.Equal(_expected[jsonTestCase.TestCase].FirstName, expected.FirstName); Assert.Null(missingParam); }
public async Task QueryAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var alpha = jsonTestCase.GetObject <string>("Alpha"); var pageNumber = jsonTestCase.GetObject <int>("PageNumber"); var pageSize = jsonTestCase.GetObject <int>("PageSize"); var expected = jsonTestCase.GetObject <List <Color> >("Expected"); var actual = await Repo.Query.Where(c => c.Name.Contains(alpha)).ToPagedListAsync(pageNumber, pageSize); Assert.True(actual.IsEqualOrWrite(expected, 2, PROPS_FILTER, Output)); }
public void Create(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <Color>("Input"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); Repo.Create(input); var actual = Repo.Query.ToPagedList() .OrderBy(x => x.Id); Assert.True(actual.IsEqualOrWrite(expected, 2, PROPS_FILTER, Output)); }
public async Task QueryAsyncEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var alpha = jsonTestCase.GetObject <string>("Alpha"); var expected = jsonTestCase.GetObject <List <Employee> >("Expected"); var actual = await Repo.Query .Where(e => e.FirstName.Contains(alpha)) .OrderBy(e => e.Id) .ToListAsync(); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public async Task CreateAndGetMultipleAsyncEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var input = jsonTestCase.GetObject <Employee>("Input"); var expected = jsonTestCase.GetObject <List <Employee> >("Expected"); var created = await Repo.CreateAsync(input); var actual = await Repo.Query.OrderBy(e => e.Id).ToListAsync(); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void UpdateAndGetMultipleEmployeePatch(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); dynamic input = jsonTestCase.GetObject <dynamic>("Input"); var expected = jsonTestCase.GetObject <List <Employee> >("Expected"); var updated = Repo.Update(input, id); var actual = Repo.Query.OrderBy(e => e.Id).ToList(); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void PostAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); Output.WriteLine($"Db instance name: {InstanceName}"); var input = jsonTestCase.GetObject <Rgb>("Input"); var expected = jsonTestCase.GetObject <List <Rgb> >("Expected"); HttpClient.Post($"api/rgb/async", input); var actual = HttpClient.Get <List <Rgb> >($"api/rgb/linq") .GetObject <List <Rgb> >(); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public async Task DeleteAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); await Repo.DeleteAsync(input); var actual = Repo.Query.ToPagedList() .OrderBy(x => x.Id); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public void GetByIdHistory(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var id = jsonTestCase.GetObject <int>("Id"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id) .ThenByDescending(x => x.SysStart); var actual = Repo.GetByIdHistory(id) .OrderBy(x => x.Id) .ThenByDescending(x => x.SysStart); Assert.True(actual.IsEqualOrWrite(expected, 2, PROPS_FILTER, Output)); }
public void Delete(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <int>("Input"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); HttpClient.Delete <Color>($"iapi/color/{input}"); var actual = HttpClient.Get <List <Color> >("iapi/color") .Object <List <Color> >() .OrderBy(x => x.Id); Assert.True(actual.IsEqualOrWrite(expected, Output)); }
public void Post(string t, JsonTestCase jsonTestCase) { Output.WriteLine($"Instance Name:{InstanceName}"); Output.WriteLine(t); var input = jsonTestCase.GetObject <Color>("Input"); var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); HttpClient.Post("api/color", input); var actual = HttpClient.Get <List <Color> >("api/color").Object <List <Color> >() .OrderBy(x => x.Id); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void PagedListEmployee(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var alpha = jsonTestCase.GetObject <string>("Alpha"); var pageNumber = jsonTestCase.GetObject <int>("PageNumber"); var pageSize = jsonTestCase.GetObject <int>("PageSize"); var expected = jsonTestCase.GetObject <List <Employee> >("Expected"); var actual = Repo.Query .Where(e => e.FirstName.Contains(alpha)) .OrderBy(e => e.Id) .ToPagedList(pageNumber, pageSize); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void Put(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); var input = jsonTestCase.GetObject <Color>("Input"); var id = input.Id; var expected = jsonTestCase.GetObject <List <Color> >("Expected") .OrderBy(x => x.Id); HttpClient.Put($"iapi/color/{id}", input); var actual = HttpClient.Get <List <Color> >("iapi/color") .Object <List <Color> >() .OrderBy(x => x.Id); Assert.True(actual.IsEqualOrWrite(expected, PROPS_FILTER, Output)); }
public void GetFromStoredProcedureAsync(string t, JsonTestCase jsonTestCase) { Output.WriteLine(t); Output.WriteLine($"Db instance name: {InstanceName}"); var spName = jsonTestCase.GetObject <string>("SpName"); var colorName = jsonTestCase.GetObject <string>("ColorName"); dynamic expected = jsonTestCase.GetObject <List <dynamic> >("Expected") .FirstOrDefault(); dynamic actual = HttpClient.Get <List <dynamic> >($"api/hsl/sp/async?spName={spName}&colorName={colorName}") .GetObject <List <dynamic> >() .FirstOrDefault(); Assert.Equal(expected, actual); }