Exemplo n.º 1
0
        public void PlayerProfileExportImportTest()
        {
            var playerProfileDTO = new PlayerProfileDTO(_defaultPlayer, DateTime.Now);
            var playerProfileCI  = new PlayerProfileCI(playerProfileDTO, _competitorId, _cultureFirst, new TestDataRouterManager(new CacheManager()));

            var exportable = (ExportablePlayerProfileCI)playerProfileCI.ExportAsync().Result;

            playerProfileCI.Import(exportable);
            var playerProfileCI2 = new PlayerProfileCI(exportable, _dataRouterManager);

            Assert.IsNotNull(playerProfileCI2);

            Compare(playerProfileCI, playerProfileCI2);
        }
Exemplo n.º 2
0
        public void PlayerProfileExportImportCreateTest()
        {
            var playerProfileDTO = new PlayerProfileDTO(_defaultPlayer, DateTime.Now);
            var playerProfileCI  = new PlayerProfileCI(playerProfileDTO, _competitorId, _cultureFirst, new TestDataRouterManager(new CacheManager()));

            var exportable = playerProfileCI.ExportAsync().Result;

            Assert.IsNotNull(exportable);
            var json = JsonConvert.SerializeObject(exportable, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });
            var importable       = JsonConvert.DeserializeObject <ExportablePlayerProfileCI>(json);
            var playerProfileCI2 = new PlayerProfileCI(importable, _dataRouterManager);

            Assert.IsNotNull(playerProfileCI2);

            Compare(playerProfileCI, playerProfileCI2);
        }
Exemplo n.º 3
0
        public void PlayerProfileExportImportMissingDataTest()
        {
            _defaultPlayer.nationality            = null;
            _defaultPlayer.nickname               = null;
            _defaultPlayer.weightSpecified        = false;
            _defaultPlayer.jersey_numberSpecified = false;
            _defaultPlayer.country_code           = null;
            var playerProfileDTO = new PlayerProfileDTO(_defaultPlayer, DateTime.Now);
            var playerProfileCI  = new PlayerProfileCI(playerProfileDTO, _competitorId, _cultureFirst, new TestDataRouterManager(new CacheManager()));

            var exportable = (ExportablePlayerProfileCI)playerProfileCI.ExportAsync().Result;

            playerProfileCI.Import(exportable);
            var playerProfileCI2 = new PlayerProfileCI(exportable, _dataRouterManager);

            Assert.IsNotNull(playerProfileCI2);

            Compare(playerProfileCI, playerProfileCI2);
        }