private void UpdateIpFunc() { IPrange i = new IPrange(); i.Put(CurrentIp.ID, new IPrange() { ID = CurrentIp.ID, IP = CurrentIp.IP }); ResetIPViewFunc(); }
public void TestIPrange() { //Get all & Post IPrange a = new IPrange(); List <IPrange> all = a.GetAll(); int orgNum = all.Count; a.Post(new IPrange() { IP = "Test ip" }); List <IPrange> allPlusOne = a.GetAll(); int newNum = allPlusOne.Count; Assert.AreEqual(newNum, orgNum + 1); //Update IPrange lastItem = allPlusOne[allPlusOne.Count - 1]; a.Put(lastItem.ID, new IPrange() { ID = lastItem.ID, IP = "Opdateret" }); List <IPrange> allAFterEdit = a.GetAll(); Assert.AreEqual(allAFterEdit[allAFterEdit.Count - 1].IP, "Opdateret"); //Delete a.Delete(lastItem.ID); int newNumOfAdminsAfterDelete = a.GetAll().Count; Assert.AreEqual(newNumOfAdminsAfterDelete, orgNum); }