コード例 #1
0
        public void Create_ShouldReturnSceneModelWithAvailableSceneBehaviorsForEachAvailableSceneBehaviorFactory()
        {
            // Arrange
            var sceneBehaviorFactoryProvider = Substitute.For <ISceneBehaviorFactoryProvider>();

            var sceneBehaviorFactory1 = Substitute.For <ISceneBehaviorFactory>();

            sceneBehaviorFactory1.BehaviorName.Returns("Behavior 1");
            var sceneBehaviorFactory2 = Substitute.For <ISceneBehaviorFactory>();

            sceneBehaviorFactory2.BehaviorName.Returns("Behavior 2");
            var sceneBehaviorFactory3 = Substitute.For <ISceneBehaviorFactory>();

            sceneBehaviorFactory3.BehaviorName.Returns("Behavior 3");

            var sceneModelFactory = new SceneModelFactory(sceneBehaviorFactoryProvider,
                                                          new[] { sceneBehaviorFactory1, sceneBehaviorFactory2, sceneBehaviorFactory3 });
            var scene = TestSceneFactory.Create();

            var sceneBehaviorName1 = new SceneBehaviorName("Behavior 1");
            var sceneBehaviorName2 = new SceneBehaviorName("Behavior 2");
            var sceneBehaviorName3 = new SceneBehaviorName("Behavior 3");

            // Act
            var sceneModel = sceneModelFactory.Create(scene);

            // Assert
            Assert.That(sceneModel.AvailableSceneBehaviors, Is.EquivalentTo(new[] { sceneBehaviorName1, sceneBehaviorName2, sceneBehaviorName3 }));
        }
コード例 #2
0
        public void Constructor_ShouldCreateSceneModelWithAvailableSceneBehaviors()
        {
            // Arrange
            var scene = TestSceneFactory.Create();

            var sceneBehavior1 = new SceneBehaviorName("Behavior 1");
            var sceneBehavior2 = new SceneBehaviorName("Behavior 2");
            var sceneBehavior3 = new SceneBehaviorName("Behavior 3");

            // Act
            var sceneModel = CreateSceneModel(scene, sceneBehavior1, sceneBehavior2, sceneBehavior3);

            // Assert
            Assert.That(sceneModel.AvailableSceneBehaviors, Has.Count.EqualTo(3));
            Assert.That(sceneModel.AvailableSceneBehaviors.Select(b => b.Value), Is.EquivalentTo(new[] { "Behavior 1", "Behavior 2", "Behavior 3" }));
        }