public HttpResponseMessage UpdateSystemFactionInfo([FromBody]SystemFactionDTO systemFaction)
        {
            var sys = systemFaction.System != null
                ? new EICSystem()
                {
                    Name = systemFaction.System.Name,
                    ControllingFaction = systemFaction.System.ControllingFaction,
                    Traffic = systemFaction.System.Traffic,
                    Population = systemFaction.System.Population,
                    Government = systemFaction.System.Government,
                    Allegiance = systemFaction.System.Allegiance,
                    State = systemFaction.System.State,
                    Security = systemFaction.System.Security,
                    Economy = systemFaction.System.Economy,
                    Power = systemFaction.System.Power,
                    PowerState = systemFaction.System.PowerState,
                    NeedPermit = systemFaction.System.NeedPermit,
                    LastUpdated = DateTime.UtcNow
                } : null;

            var fac = systemFaction.Faction != null
                ? new EICFaction()
                {
                    Name = systemFaction.Faction.Name,
                    Allegiance = systemFaction.Faction.Allegiance
                } : null;

            var sysFac = new EICSystemFaction()
            {
                System = sys,
                Faction = fac,
                Influence = systemFaction.Influence,
                CurrentState = systemFaction.CurrentState,
                PendingState = systemFaction.PendingState,
                RecoveringState = systemFaction.RecoveringState,
                UpdatedBy = systemFaction.UpdatedBy
            };

            _systemTrackerService.UpdateSystemFactionInfo(sysFac);

            HttpResponseMessage response = Request.CreateResponse(System.Net.HttpStatusCode.OK);
            return response;
        }
Пример #2
0
        public void addUpdatetracking_mysql_success_test()
        {
            // arrange
            IEICData eicData = EICDataFactory.GetDataAdapter(DataAdapterType.MySql);
            IEICSystemFaction sysFaction = new EICSystemFaction()
            {
                System = new EICSystem()
                {
                    Name = "Kappa Fornacis",
                    Traffic = 30,
                    Population = 7500000,
                    Government = "Corporate",
                    Security = "Medium",
                    Allegiance = "Empire",
                    State = "Expansion",
                    Economy = "Agriculture",
                    Power = "Zemina Torval",
                    PowerState = "Control",
                    NeedPermit = false
                },
                Faction = new EICFaction()
                {
                    Name = "East India Company",
                    Allegiance = "Empire"
                },
                Influence = 50.6,
                CurrentState = "Expansion",
                PendingState = "Boom, Civil Unrest",
                RecoveringState = "Boom",
                UpdatedBy = "UnitTest"
            };

            // act
            eicData.AddSystemFactionTracking(sysFaction);

            // assert
            // if exception, we fail.
        }