Ejemplo n.º 1
0
        public void CountrySubdivisionRepository_AddValue()
        {
            var repo = new CountrySubdivisionRepository();

            var key          = "AAA";
            var subdivisions = new List <SubdivisionInfo>
            {
                new SubdivisionInfo
                {
                    CountrySubdivisionCode = "AAA-1",
                    CountrySubdivisionName = "AAA 1"
                },
                new SubdivisionInfo
                {
                    CountrySubdivisionCode = "AAA-2",
                    CountrySubdivisionName = "AAA 2"
                }
            };

            repo.AddValue(key, subdivisions);

            var value       = repo.GetValue <List <SubdivisionInfo> >(key);
            var containsKey = repo.ContainsKey(key);

            Assert.IsNotNull(value);
            Assert.IsTrue(containsKey);
            Assert.AreEqual(2, value.Count);
        }
Ejemplo n.º 2
0
        public void CountrySubdivisionRepository_RemoveValue()
        {
            var repo = new CountrySubdivisionRepository();

            var key = "CAN";

            repo.RemoveValue(key);

            var containsKey = repo.ContainsKey(key);

            Assert.IsFalse(containsKey);
        }
Ejemplo n.º 3
0
        public void CountrySubdivisionRepository_UpdateValue()
        {
            var repo = new CountrySubdivisionRepository();

            var key         = "MEX";
            var subdivisons = new List <SubdivisionInfo>
            {
                new SubdivisionInfo
                {
                    CountrySubdivisionCode = "MX-BCN",
                    CountrySubdivisionName = "Baja California"
                }
            };

            repo.UpdateValue(key, subdivisons);

            var value       = repo.GetValue <List <SubdivisionInfo> >(key);
            var containsKey = repo.ContainsKey(key);

            Assert.IsNotNull(value);
            Assert.IsTrue(containsKey);
            Assert.AreEqual(1, value.Count);
            Assert.AreEqual("MX-BCN", value.FirstOrDefault()?.CountrySubdivisionCode);
        }