Пример #1
0
        public void CreateWithRegionInfoTest()
        {
            var i = new RegionInfo("ee-EE");

            o = CurrencyObjectFactory.Create(i);
            validateResults(i.ISOCurrencySymbol, i.CurrencyEnglishName, i.CurrencySymbol);
        }
Пример #2
0
        public void CreateTest()
        {
            var b = GetRandom.Object <CurrencyDbRecord>();

            o = CurrencyObjectFactory.Create(b.ID, b.Name, b.Code, b.ValidFrom, b.ValidTo);
            validateResults(b.ID, b.Name, b.Code, b.ValidFrom, b.ValidTo);
        }
Пример #3
0
        public static void Initialize(SentryDbContext c)
        {
            c.Database.EnsureCreated();
            if (c.Currencies.Any())
            {
                return;
            }
            var list    = new List <string>();
            var regions = SystemRegionInfo.GetRegionsList();

            foreach (var r in regions)
            {
                if (!SystemRegionInfo.IsCountry(r))
                {
                    continue;
                }
                if (list.Contains(r.ISOCurrencySymbol))
                {
                    continue;
                }
                var e = CurrencyObjectFactory.Create(r);
                c.Currencies.Add(e.DbRecord);
                list.Add(r.ISOCurrencySymbol);
            }
            c.SaveChanges();
        }
Пример #4
0
        [HttpPost] // [ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind(properties)] CurrencyViewModel c)
        {
            await validateId(c.IsoCode, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(c));
            }
            var o = CurrencyObjectFactory.Create(c.IsoCode, c.Name, c.Symbol, c.ValidFrom, c.ValidTo);
            await repository.AddObject(o);

            return(RedirectToAction("Index"));
        }
Пример #5
0
        public static void Initialize(ICurrencyObjectsRepository c)
        {
            if (c.IsInitialized())
            {
                return;
            }
            var regions = SystemRegionInfo.GetRegionsList();

            foreach (var r in regions)
            {
                if (!SystemRegionInfo.IsCountry(r))
                {
                    continue;
                }
                var e = CurrencyObjectFactory.Create(r);
                c.AddObject(e);
            }
        }
Пример #6
0
 public void CreateWithNullRegionInfoTest()
 {
     o = CurrencyObjectFactory.Create(null);
     validateResults();
 }
Пример #7
0
 public void CreateValidFromGreaterThanValidToTest()
 {
     o = CurrencyObjectFactory.Create(id, name, code, validTo, validFrom);
     validateResults(id, name, code, validFrom, validTo);
 }
Пример #8
0
 public void CreateWithNameOnlyTest()
 {
     o = CurrencyObjectFactory.Create(null, name, null);
     validateResults(name, name);
 }
Пример #9
0
 public void CreateWithCodeOnlyTest()
 {
     o = CurrencyObjectFactory.Create(null, null, code);
     validateResults(code, code, code);
 }
Пример #10
0
 public void CreateWithNullArgumentsTest()
 {
     o = CurrencyObjectFactory.Create(null, null, null);
     validateResults();
 }