Exemplo n.º 1
0
        public void DeleteTroopObject_WhenTroopObjectFailsToRemoveFromCity_DoesNotAddUnitsBackToStub(
            [Frozen] ITroopStub stub,
            [Frozen] ISimpleStub unitsToRetreat,
            StationedPartialTroopObjectInitializer troopInitializer)
        {
            unitsToRetreat.TotalCount.Returns <ushort>(1);
            stub.State.Returns(TroopState.Stationed);
            stub.RemoveFromFormation(FormationType.Defense, Arg.Any <ISimpleStub>()).Returns(true);

            var newStub = Substitute.For <ITroopStub>();

            newStub.TroopId.Returns <ushort>(5);
            stub.City.CreateTroopStub().Returns(newStub);

            stub.City.Troops.Remove(newStub.TroopId).Returns(false);

            ITroopObject troopObject;

            troopInitializer.GetTroopObject(out troopObject);

            troopInitializer.DeleteTroopObject();

            stub.DidNotReceiveWithAnyArgs().AddAllToFormation(FormationType.Defense, null);
        }