示例#1
0
        public void WhenOneShouldSelectFirstTool()
        {
            var toolSelector = new PlayerToolSelector(ToolResourcePaths.Paths);

            toolSelector.SwitchTool(1);
            Assert.IsTrue(toolSelector.CurrentTool.Id == (ushort)PlayerToolType.Line1);
        }
示例#2
0
        public void WhenOneShouldHaveInstanceOfLine1Tool()
        {
            var toolSelector = new PlayerToolSelector(ToolResourcePaths.Paths);

            toolSelector.SwitchTool(1);
            Assert.IsNotNull(toolSelector.CurrentTool.Object, "CurrentToolObject Not Set");
            Assert.IsNotNull(toolSelector.CurrentTool.Object.GetComponent <LineToolBehaviour>());
        }
示例#3
0
        public void WhenToolSetToNone_ShouldDeactivateCurrentTool()
        {
            var toolSelector = new PlayerToolSelector(ToolResourcePaths.Paths);

            toolSelector.SwitchTool(1);
            var currentTool = toolSelector.CurrentTool.Object;

            toolSelector.SwitchTool((ushort)PlayerToolType.None);
            Assert.IsFalse(currentTool.activeSelf);
        }
示例#4
0
 public void WhenLoadingInvalidPath_ShouldThrow()
 {
     Assert.Catch <ToolPrefabNotFoundException>(
         () =>
         PlayerToolSelector
         .LoadToolPrefab(new Dictionary <ushort, string>
     {
         { 1, "Prefabs/Invalid" }
     }, 1));
 }
示例#5
0
 public void WhenLoadingInvalidToolId_ShouldThrow()
 {
     Assert.Catch <NoPathForToolIdException>(() =>
                                             PlayerToolSelector.LoadToolPrefab(ToolResourcePaths.Paths, 532));
 }
示例#6
0
 public void WhenLoadingValidToolId_ShouldGetObject()
 {
     Assert.IsNotNull(PlayerToolSelector.LoadToolPrefab(ToolResourcePaths.Paths, 1));
 }