public void op_Load_FileInfoNotFound() { using (var temp = new TempDirectory()) { var file = temp.Info.ToFile("sabc.csv"); Assert.Throws <FileNotFoundException>(() => BritishTelephoneNumberPlan.Load(file)); } }
public void op_Load_KeyStringDictionary_when3DigitAreaCode() { var entry = new KeyStringDictionary { { "Code", "1999" }, { "D/DE", string.Empty }, { "Notes", "3 Digit Area Code" }, { "Use", "Example" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("199", actual.AreaCode); Assert.Equal("1999", actual.DialingCode); Assert.Equal("Example", actual.Use); }
public void op_Load_KeyStringDictionary_whenNottingham() { var entry = new KeyStringDictionary { { "Code", "1152" }, { "D/DE", "0" }, { "Notes", "3 Digit Area Code" }, { "Use", "Nottingham" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("115", actual.AreaCode); Assert.Equal("11520", actual.DialingCode); Assert.Equal("Nottingham", actual.Use); }
public void op_Load_KeyStringDictionary_whenSedbergh() { var entry = new KeyStringDictionary { { "Code", "1539" }, { "D/DE", "6" }, { "Notes", "5 Digit Code Area" }, { "Use", "Sedbergh" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("15396", actual.AreaCode); Assert.Equal("15396", actual.DialingCode); Assert.Equal("Sedbergh", actual.Use); }
public void op_Load_KeyStringDictionary_whenLancaster() { var entry = new KeyStringDictionary { { "Code", "1524" }, { "D/DE", "5" }, { "Notes", "4 Digit Code Area" }, { "Use", "Lancaster" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("1524", actual.AreaCode); Assert.Equal("15245", actual.DialingCode); Assert.Equal("Lancaster", actual.Use); }
public void op_Load_KeyStringDictionary_whenLondon() { var entry = new KeyStringDictionary { { "Code", "2071" }, { "D/DE", string.Empty }, { "Notes", string.Empty }, { "Use", "London" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("20", actual.AreaCode); Assert.Equal("2071", actual.DialingCode); Assert.Equal("London", actual.Use); }
public void op_Load_KeyStringDictionary_whenHarrogate() { var entry = new KeyStringDictionary { { "Code", "1423" }, { "D/DE", "6" }, { "Notes", "ELNS" }, { "Use", "Harrogate" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("14236", actual.AreaCode); Assert.Equal("14236", actual.DialingCode); Assert.Equal("Harrogate", actual.Use); }
public void op_Load_KeyStringDictionary_whenGlasgow() { var entry = new KeyStringDictionary { { "Code", "1412" }, { "D/DE", string.Empty }, { "Notes", "3 Digit Code Area" }, { "Use", "Glasgow" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("141", actual.AreaCode); Assert.Equal("1412", actual.DialingCode); Assert.Equal("Glasgow", actual.Use); }
public void op_Load_KeyStringDictionary_whenColchester() { var entry = new KeyStringDictionary { { "Code", "1206" }, { "D/DE", string.Empty }, { "Notes", string.Empty }, { "Use", "Colchester" }, }; var actual = BritishTelephoneNumberPlan.Load(entry); Assert.Equal("1206", actual.AreaCode); Assert.Equal("1206", actual.DialingCode); Assert.Equal("Colchester", actual.Use); }
public void op_Load_BritishTelephoneNumberPlan_Telephone_whenInvalid(string number) { var plan = BritishTelephoneNumberPlan.Load(new FileInfo("sabc.csv")); Telephone telephone = number; var actual = BritishTelephone.Load(plan, telephone); Assert.Empty(actual.Area); Assert.Empty(actual.AreaCode); Assert.Empty(actual.NumberGroups); Assert.Empty(actual.DialingCode); Assert.Empty(actual.LocalNumber); Assert.Empty(actual.ServiceType); Assert.Equal(telephone, actual.Number); Assert.False(actual.IsValid); }
public void op_Load_BritishTelephoneNumberPlan_Telephone(string number, bool valid, string area, string areaCode, string numberGroups, string dialingCode, string localNumber, string serviceType) { var plan = BritishTelephoneNumberPlan.Load(new FileInfo("sabc.csv")); Telephone telephone = number; var actual = BritishTelephone.Load(plan, telephone); Assert.Equal(area, actual.Area); Assert.Equal(areaCode, actual.AreaCode); Assert.Equal(numberGroups, actual.NumberGroups); Assert.Equal(dialingCode, actual.DialingCode); Assert.Equal(localNumber, actual.LocalNumber); Assert.Equal(serviceType, actual.ServiceType); Assert.Equal(telephone, actual.Number); Assert.Equal(valid, actual.IsValid); }
public void op_Load_KeyStringDictionaryNull() { Assert.Throws <ArgumentNullException>(() => BritishTelephoneNumberPlan.Load(null as KeyStringDictionary)); }
public void op_Load_FileInfoNull() { Assert.Throws <ArgumentNullException>(() => BritishTelephoneNumberPlan.Load(null as FileInfo)); }
public void op_Load_FileInfo() { var plan = BritishTelephoneNumberPlan.Load(new FileInfo("sabc.csv")); Assert.NotEmpty(plan); }