public void Update_HeadersNull_Throws() { // arrange var manager = new HeaderManager(); // act // assert Assert.Throws <ArgumentNullException>(() => manager.Update(null)); }
public void Update_CacheUpdated_Success() { // arrange var items = new List <(string, string)> { (ResponseHeader.PageSize.Name, "50"), (ResponseHeader.Count.Name, "100"), }; var manager = new HeaderManager(); // act manager.Update(items); // assert Assert.NotEmpty(manager.Get <string>(ResponseHeader.PageSize)); }
public void Get_KeyDoesNotExist_ReturnsDefault() { // arrange var items = new List <(string, string)> { ("key1", "value1"), ("key2", "value2"), }; var manager = new HeaderManager(); manager.Update(items); // act var result = manager.Get <string>(ResponseHeader.PageSize); // assert Assert.Null(result); }
public void Get_FailsConvertion_ReturnsDefault() { // arrange var items = new List <(string, string)> { (ResponseHeader.PageSize.Name, "Not an integer"), (ResponseHeader.Count.Name, "100"), }; var manager = new HeaderManager(); manager.Update(items); // act var result = manager.Get <int>(ResponseHeader.PageSize); // assert Assert.Equal(0, result); }
public void Get_KeyExists_Success() { // arrange const int PAGE_SIZE = 50; var items = new List <(string, string)> { (ResponseHeader.PageSize.Name, PAGE_SIZE.ToString()), (ResponseHeader.Count.Name, "100"), }; var manager = new HeaderManager(); manager.Update(items); // act var result = manager.Get <int>(ResponseHeader.PageSize); // assert Assert.Equal(PAGE_SIZE, result); }