Beispiel #1
0
 public Item(Item item, uint quantity, Corporation newOwner)
 {
     ItemInfo = item.ItemInfo;
     Quantity = quantity;
     Location = item.Location;
     Owner = newOwner;
 }
Beispiel #2
0
            private static Agent AddEmployee(Corporation target, Agent agent)
            {
                target.Employees.Add(agent);
                agent.Corporation = target;

                return agent;
            }
Beispiel #3
0
        public void CorporationHangar()
        {
            var corp = new Corporation();
            var location = new Manufactory();

            var property = corp.GetProperty(location);
            property.Add(new Item(new ItemInfo()));
        }
Beispiel #4
0
 public static CorporationState Save(Corporation corporation)
 {
     return new CorporationState
     {
         ObjectId = corporation.Id,
         Name = corporation.Name,
         Employees = corporation.Employees.Select(Agent.Builder.Save),
     };
 }
Beispiel #5
0
        public void CantHireAgentEmployedBySomeoneElse()
        {
            var state = new AgentState();
            var agent = Agent.Builder.Build(state).Build(new TestIdResolver());

            var c1 = new Corporation();
            c1.Hire(agent);

            var c2 = new Corporation();
            Should.Throw<ArgumentException>(() => c2.Hire(agent));
        }
Beispiel #6
0
        public void CanBeHired()
        {
            var state = new AgentState();
            var agent = Agent.Builder.Build(state).Build(new TestIdResolver());

            var corporation = new Corporation();
            corporation.Hire(agent);

            agent.Corporation.ShouldBe(corporation);
            corporation.Employees.ShouldContain(agent);
        }
Beispiel #7
0
        public static Agent StandUp(this AgentState state, Corporation corporation = null, ILocation initialLocation = null)
        {
            var idResolver = IdResolver.Empty;

            if (initialLocation != null)
            {
                state.Location = initialLocation.AsObjectReference();
                idResolver = new IdResolutionContext(new[] { initialLocation });
            }

            var builder = Agent.Builder.Build(state)
                .Resolve((r, a) => a.Corporation = corporation);

            return builder.Materialise(idResolver.RegisterTestSkills());
        }
Beispiel #8
0
            public static ObjectBuilder<Corporation> Build(CorporationState state)
            {
                var corporation = new Corporation
                {
                    Id = state.ObjectId,
                    Name = state.Name,
                };

                var builder = new ObjectBuilder<Corporation>(corporation);

                builder
                    .Dependents(state.Employees)
                    .Build(Agent.Builder.Build)
                    .Resolve((resolver, target, agent) => AddEmployee(target, agent));

                return builder;
            }
Beispiel #9
0
            public static ObjectBuilder<Item> Build(ItemState state, ILocation location = null, Corporation owner = null)
            {
                var objRef = state.Type.ToObjectReference(state.Code);
                var item = new Item
                {
                    Id = state.ObjectId,
                    Quantity = state.Quantity,
                    Location = location,
                    Owner = owner,
                };

                var builder = new ObjectBuilder<Item>(item);

                builder
                    .Resolve((resolver, target) => item.ItemInfo = resolver.Get<ItemInfo>(objRef));

                return builder;
            }
Beispiel #10
0
 public void ObjectTypeIsCorporation()
 {
     var corp = new Corporation();
     corp.ObjectType.ShouldBe(ObjectType.Corporation);
 }
Beispiel #11
0
 public void CorporationVessels()
 {
     var corp = new Corporation();
     corp.Ships.Add(new Ship());
 }
Beispiel #12
0
 public void CorporationStructures()
 {
     var corp = new Corporation();
     corp.Structures.Add(new Manufactory());
 }
Beispiel #13
0
 public void CorporationMembers()
 {
     var corp = new Corporation();
     corp.Employees.Add(new Agent());
 }
Beispiel #14
0
 public void CorporationItems()
 {
     var corp = new Corporation();
     corp.Property.Add(new Item(new ItemInfo(ItemCode.LightFrigate)));
 }
Beispiel #15
0
 public void CorporationBluePrints()
 {
     var corp = new Corporation();
     corp.BluePrints.Add(new Item(new BluePrintInfo()));
 }
Beispiel #16
0
 public void CorporationAuctions()
 {
     var corp = new Corporation();
     corp.BuyOrders.Add(new BuyOrder());
     corp.SellOrders.Add(new SellOrder());
 }