Setting a property value on a fake (FakeItEasy library) seems not to work

Viewed 261

I want to create interrelated objects via the FakeItEasy framework the following way

        var gameWorld = A.Fake<IGameWorld>();
        var entityManager = A.Fake<IEntityManager>();
        A.CallTo(() => gameWorld.EntityManager).Returns(entityManager);
        var mapLevel = A.Fake<MapLevel>();
        A.CallTo(() => entityManager.GetCurrentAirSeaMapLevel()).Returns(mapLevel);
        var bounds = new Rectangle(0, 0, 100, 100);
        mapLevel.Bounds = bounds;

The issue is if I later call mapLevel.Bounds in the to tested coding, bounds is a generic dummy/fake, set by the framework and not the property(Bounds) which I have set.

What am I doing wrong ?

0 Answers
Related