예제 #1
0
 public SceneSerializer(ISceneFactory sceneFactory, ISceneBehaviorFactoryProvider sceneBehaviorFactoryProvider,
                        IComponentFactoryProvider componentFactoryProvider, IAssetStore assetStore)
 {
     _sceneFactory = sceneFactory;
     _sceneBehaviorFactoryProvider = sceneBehaviorFactoryProvider;
     _componentFactoryProvider     = componentFactoryProvider;
     _assetStore = assetStore;
 }
        public void SetUp()
        {
            _sceneFactory = Substitute.For <ISceneFactory>();
            _sceneFactory.Create().Returns(ci => TestSceneFactory.Create());

            _sceneBehaviorFactoryProvider = Substitute.For <ISceneBehaviorFactoryProvider>();
            var emptySceneBehaviorFactory = Substitute.For <ISceneBehaviorFactory>();

            emptySceneBehaviorFactory.BehaviorName.Returns(string.Empty);
            emptySceneBehaviorFactory.Create(Arg.Any <Scene>())
            .Returns(ci => SceneBehavior.CreateEmpty(ci.Arg <Scene>()));
            _sceneBehaviorFactoryProvider.Get(string.Empty).Returns(emptySceneBehaviorFactory);

            _componentFactoryProvider = Substitute.For <IComponentFactoryProvider>();
            _assetStore = Substitute.For <IAssetStore>();

            _sceneSerializer = new SceneSerializer(_sceneFactory, _sceneBehaviorFactoryProvider, _componentFactoryProvider, _assetStore);
        }