Esempio n. 1
0
        public void CommitChanges_Query_ReturnsObject()
        {
            // arrange
            var fileName = $"{ToString()}.{MethodBase.GetCurrentMethod().Name}()";

            using (var dataRepository = new DataRepositorySqliteWarThunder(fileName, true, Assembly.Load(EAssembly.WarThunderMappingAssembly), false, Presets.Logger))
            {
                var britain     = new Nation(dataRepository, EReference.NationsFromEnumeration[ENation.GreatBritain]);
                var britishArmy = new Branch(dataRepository, EReference.BranchesFromEnumeration[EBranch.Army], britain);

                var wingedBicycle = new Vehicle(dataRepository, "Winged Bycicle")
                {
                    Nation = britain,
                    Branch = britishArmy,
                };

                // act
                dataRepository.PersistNewObjects();

                var query = dataRepository.Query <IVehicle>();
                query.Count().Should().Be(1);

                var vehicle = query.First();

                // assert
                vehicle.IsEquivalentTo(wingedBicycle, 2, _ignoredPropertyNames).Should().BeTrue();
            }
        }
        public void CommitChanges_Query_ReturnsObject()
        {
            // arrange
            var fileName = $"{ToString()}.{MethodBase.GetCurrentMethod().Name}()";

            using (var dataRepository = new DataRepositorySqliteWarThunder(fileName, true, Assembly.Load(EAssembly.WarThunderMappingAssembly), true, Presets.Logger))
            {
                var britain     = new Nation(dataRepository, EReference.NationsFromEnumeration[ENation.GreatBritain]);
                var britishArmy = new Branch(dataRepository, EReference.CategoriesFromEnumeration[EVehicleCategory.Army], britain);
                britain.Branches = new List <IBranch> {
                    britishArmy
                };

                // act
                dataRepository.PersistNewObjects();

                var query = dataRepository.Query <IBranch>();
                query.Count().Should().Be(1);

                var branch = query.First();

                // assert
                branch.IsEquivalentTo(britishArmy, 2, _ignoredPropertyNames).Should().BeTrue();
            }
        }
        public void DeserializeAndPersistNationList()
        {
            // arrange
            var blkxFiles    = _manager.GetBlkxFiles(EFile.WarThunder.StatAndBalanceParameters, false);
            var rankJsonText = _manager.GetJsonText(blkxFiles, EFile.CharVromfs.RankData);

            // act
            var databaseFileName = $"{ToString()}.{MethodBase.GetCurrentMethod().Name}()";

            using (var dataRepository = new DataRepositorySqliteWarThunder(databaseFileName, true, Assembly.Load(EAssembly.WarThunderMappingAssembly), false, Presets.Logger))
            {
        public void CommitChanges_Query_ReturnsObject()
        {
            // arrange
            var fileName = $"{ToString()}.{MethodBase.GetCurrentMethod().Name}()";

            using (var dataRepository = new DataRepositorySqliteWarThunder(fileName, true, Assembly.Load(EAssembly.WarThunderMappingAssembly), false, Presets.Logger))
            {
                // act
                var britain = new Nation(dataRepository, EReference.NationsFromEnumeration[ENation.GreatBritain]);

                dataRepository.PersistNewObjects();

                var query = dataRepository.Query <INation>();
                query.Count().Should().Be(1);

                var nation = query.First();

                // assert
                nation.IsEquivalentTo(britain, 1, _ignoredPropertyNames).Should().BeTrue();
            }
        }