public void UpdateMesh()
    {
        if (tasks == null)
        {
            tasks = new HashSet <Task>();
        }

        if (tasks.Count > 0 && FUtils.All(tasks, task => task == null || task.IsCompleted || task.IsFaulted || task.IsCanceled))
        {
            tasks.Clear();
            FUtils.Elvis(eventManager, eventManager =>
                         eventManager.DiggingChanged(DiggingMode.NotDigging));

            navMesh = new NavMesh();
            foreach (VoxelSurface surface in GetComponentsInChildren <VoxelSurface>())
            {
                surface.UpdateMesh();
                navMesh.Merge(surface.navMesh, surface.meshCoords, pointDensity, surface.transform);
            }

            Debug.Log("Finished generating mesh positions count=" + navMesh.positions.Count);
            if (navMesh.positions.Count > 0)
            {
                player                = FindObjectOfType <SimpleController>();
                monster               = FindObjectOfType <MonsterController>();
                localPlayerPosition   = transform.InverseTransformPoint(player.transform.position);
                localCreaturePosition = transform.InverseTransformPoint(monster.transform.position);
                playerCell            = navMesh.ClosestCell(localPlayerPosition);
                monsterCell           = navMesh.ClosestCell(localCreaturePosition);
                path = navMesh.FindPath(localPlayerPosition, localCreaturePosition);
            }
        }
    }
Esempio n. 2
0
 void Start()
 {
     _rb         = GetComponent <Rigidbody>();
     _rbBall     = ballTransform.GetComponent <Rigidbody>();
     _airControl = GetComponentInChildren <SimpleAirControl>();
     _controller = GetComponentInChildren <SimpleController>();
 }
Esempio n. 3
0
 private void DrawSimpleControllerSection(SimpleController simpleController)
 {
     EditorWindowTools.StartIndentedSection();
     if ((simpleController.idle == null) || (simpleController.runForward == null))
     {
         EditorGUILayout.HelpBox("The player uses third-person shooter style controls. At a minimum, Idle and Run animations are required. Click Select Player to customize further.", MessageType.Info);
     }
     simpleController.idle       = EditorGUILayout.ObjectField("Idle Animation", simpleController.idle, typeof(AnimationClip), false) as AnimationClip;
     simpleController.runForward = EditorGUILayout.ObjectField("Run Animation", simpleController.runForward, typeof(AnimationClip), false) as AnimationClip;
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.LabelField("Optional", EditorStyles.boldLabel);
     simpleController.runSpeed = EditorGUILayout.FloatField("Run Speed", simpleController.runSpeed);
     simpleController.runBack  = EditorGUILayout.ObjectField("Run Back", simpleController.runBack, typeof(AnimationClip), false) as AnimationClip;
     simpleController.aim      = EditorGUILayout.ObjectField("Aim", simpleController.aim, typeof(AnimationClip), false) as AnimationClip;
     simpleController.fire     = EditorGUILayout.ObjectField("Fire", simpleController.fire, typeof(AnimationClip), false) as AnimationClip;
     if (simpleController.fire != null)
     {
         if (simpleController.upperBodyMixingTransform == null)
         {
             EditorGUILayout.HelpBox("Specify the upper body mixing transform for the fire animation.", MessageType.Info);
         }
         simpleController.upperBodyMixingTransform = EditorGUILayout.ObjectField("Upper Body Transform", simpleController.upperBodyMixingTransform, typeof(Transform), true) as Transform;
         simpleController.fireLayerMask            = EditorGUILayout.LayerField("Fire Layer", simpleController.fireLayerMask);
         simpleController.fireSound = EditorGUILayout.ObjectField("Fire Sound", simpleController.fireSound, typeof(AudioClip), false) as AudioClip;
         AudioSource audioSource = pcObject.GetComponent <AudioSource>();
         if (audioSource == null)
         {
             audioSource             = pcObject.AddComponent <AudioSource>();
             audioSource.playOnAwake = false;
             audioSource.loop        = false;
         }
     }
     EditorWindowTools.EndIndentedSection();
     EditorWindowTools.EndIndentedSection();
 }
Esempio n. 4
0
        /// <summary>
        /// Construct self from a model and active animation name.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="animName"></param>
        public ModelAnim(FBXModel model, string animName)
        {
            ActiveAnimation = new AnimatorList(model);
            if (ActiveAnimation.NotEmpty)
            {
                AnimationInstance sample = ActiveAnimation.Sample;
                ActiveController = SimpleController.TryMake(sample, animName, sample.FirstAnimationName);

                if (ActiveController != null)
                {
                    ActiveAnimation.ApplyController(ActiveController);

                    IdleAnimation = new AnimatorList(model);
                    Debug.Assert(IdleAnimation.NotEmpty, "Could make active but not idle?");
                    sample         = IdleAnimation.Sample;
                    IdleController = SimpleController.TryMake(sample, "idle", null);
                    if (IdleController != null)
                    {
                        IdleAnimation.ApplyController(IdleController);
                    }
                    else
                    {
                        IdleAnimation = null;
                    }
                }
                else
                {
                    ActiveAnimation = null;
                }
            }
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        //saves the reference to the gameController...
        gameController = GameObject.FindWithTag("GameController").GetComponent <GameStateController>();

        //...and to SimpleControls
        controls = GetComponent <SimpleController>();
    }
Esempio n. 6
0
    void CmdSetTeam(int whichTeam)    //float rx, float ry, float rz
    {
        teamPlayer = whichTeam;
        setTeam(whichTeam);
        SimpleController scriptMovement = GetComponent <SimpleController> ();

        scriptMovement.team = whichTeam;
    }
        public async Task TestWithoutReflection()
        {
            var controller = new SimpleController();

            var result = (OkNegotiatedContentResult <string>) await controller.Get();

            result.Content.ShouldBeEquivalentTo("Hello world");
        }
        private CommandProcessor CreateInvokerWithSimpleController()
        {
            simpleController = new SimpleController();
            var objects      = new[] { simpleController };
            var actionInvoke = new CommandProcessor(objects);

            return(actionInvoke);
        }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        //whichTeam = gameObject.CompareTag ("VehicleTeam0") ? 0 : 1;

        //body = GetComponent<Rigidbody> ();
        Transform user = transform.FindChild("HUD").FindChild("User");

        text = user.GetComponent <Text> ();
        Transform lifeBar = transform.FindChild("HUD").FindChild("User").FindChild("HUDLife");

        healthRect   = lifeBar.FindChild("Life").GetComponent <Image> ();
        timerRespawn = startTimerRespawn;

        loaderScript = GetComponent <LoaderClass> ();

        scriptMovement = GetComponent <SimpleController> ();

        cameraObject = GameObject.Find("MainCamera");

        if (isLocalPlayer)
        {
            hitLaser = new List <GameObject> ();

            user.gameObject.SetActive(false);
            //lifeBar.gameObject.SetActive (false);

            //if (setLifeBar) {
            Drifter = GameObject.Find("Life");
            Camper  = GameObject.Find("Life31");
            Miner   = GameObject.Find("Life17");


            if (loaderScript.vehicleTypeClass == 1)                                  //if it's a miner
            {
                Miner.SetActive(true);
                Drifter.SetActive(false);
                Camper.SetActive(false);
                lifeLoader = GameObject.Find("LifeLoader17");                              //takes the object LifeLoader
            }
            else if (loaderScript.vehicleTypeClass == 0)                                   //if it's a drifter
            {
                Drifter.SetActive(true);
                Miner.SetActive(false);
                Camper.SetActive(false);
                lifeLoader = GameObject.Find("LifeLoader");                             //takes the object LifeLoader31
            }
            else if (loaderScript.vehicleTypeClass == 2)                                //if it's a camper
            {
                Camper.SetActive(true);
                Drifter.SetActive(false);
                Miner.SetActive(false);
                lifeLoader = GameObject.Find("LifeLoader31");                             //takes the object LifeLoader17
            }

            //setLifeBar = false;
            //}
        }
    }
Esempio n. 10
0
    void Start()
    {
        _controller = _agent.GetComponentInChildren <SimpleController>();

        // GUI stuff
        _style = new GUIStyle();
        _style.normal.textColor = Color.red;
        _style.fontSize         = 25;
        _style.fontStyle        = FontStyle.Bold;
    }
Esempio n. 11
0
    public void DisplayWeb(string webUrl, string title)
    {
        WebRoot.SetActive(true);
        VideoRoot.SetActive(false);
        curUrl = webUrl;
        SimpleController webControl = WebRoot.GetComponentInChildren <SimpleController> ();

        webControl.GoToUrl(webUrl);
        TitleText.text = title;
    }
Esempio n. 12
0
        public void Index_Default_ResultOk()
        {
            // arrange
            SimpleController target = new SimpleController();

            // act
            var result = target.Index();

            // assert
            Assert.IsType <HttpOkResult>(result);
        }
Esempio n. 13
0
 public void Initializer()
 {
     _boolController = new(new ControllerDefinition("Dummy Gamepad")
     {
         BoolButtons = { "A" }
     }.MakeImmutable());
     _axisController = new(
         new ControllerDefinition("Dummy Gamepad")
         .AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), MidValue)
         .MakeImmutable());
 }
    // Start is called before the first frame update
    void Start()
    {
        myPoints = 0;

        lives = 3;

        levelDuration = 20;

        gameRunning = true;

        controls = GetComponent <SimpleController>();
    }
Esempio n. 15
0
        private void AddDeckControlButtons()
        {
            var controllers = new SimpleController
            {
                Definition = _deck.GetDefinition()
            };

            // TODO: FDS
            // Yes, this adds them to the deck definition too
            controllers.Definition.BoolButtons.Add("Reset");
            controllers.Definition.BoolButtons.Add("Power");
        }
Esempio n. 16
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your Player is ready! Below is a summary of the configuration.", MessageType.Info);
            SimpleController     simpleController     = pcObject.GetComponent <SimpleController>();
            NavigateOnMouseClick navigateOnMouseClick = pcObject.GetComponent <NavigateOnMouseClick>();

            if (simpleController != null)
            {
                EditorGUILayout.LabelField("Control: Third-Person Shooter Style");
            }
            else if (navigateOnMouseClick != null)
            {
                EditorGUILayout.LabelField("Control: Follow Mouse Clicks");
            }
            else
            {
                EditorGUILayout.LabelField("Control: Custom");
            }
            switch (GetSelectorType())
            {
            case SelectorType.CenterOfScreen: EditorGUILayout.LabelField("Targeting: Center of Screen"); break;

            case SelectorType.CustomPosition: EditorGUILayout.LabelField("Targeting: Custom Position (you must set Selector.CustomPosition)"); break;

            case SelectorType.MousePosition: EditorGUILayout.LabelField("Targeting: Mouse Position"); break;

            case SelectorType.Proximity: EditorGUILayout.LabelField("Targeting: Proximity"); break;

            default: EditorGUILayout.LabelField("Targeting: None"); break;
            }
            SetEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (enabler != null)
            {
                ShowDisabledComponents(enabler.onStart);
            }
            ShowCursorOnConversation showCursor = pcObject.GetComponentInChildren <ShowCursorOnConversation>();

            if (showCursor != null)
            {
                EditorGUILayout.LabelField("Show Cursor During Conversations: Yes");
            }
            PersistentPositionData persistentPositionData = pcObject.GetComponentInChildren <PersistentPositionData>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (persistentPositionData != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Esempio n. 17
0
        public void Initializer()
        {
            _boolController = new SimpleController
            {
                Definition = new ControllerDefinition {
                    BoolButtons = { "A" }
                }
            };

            _axisController = new SimpleController
            {
                Definition = new ControllerDefinition().AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), 100)
            };
        }
Esempio n. 18
0
        public void GetCollectionOfAccountsInJsonFormat_Succeeds()
        {
            var toc  = new TestObjectsCreator();
            var conn = new ApiConnection(toc.ApiConnector(), toc.UriCrmAccount(toc.GetCurrentDivision()));

            var            c        = new SimpleController(conn);
            List <dynamic> accounts = c.GetDynamic(string.Empty);

            // Test if list has entities (easy test, because actual entity count isn't known)
            if (accounts.Count < 1)
            {
                throw new Exception("User Story not correctly implemented: List of CRM/Accounts is empty");
            }
        }
Esempio n. 19
0
        private IController EmptyLmsvFrame()
        {
            var emptyController = new SimpleController
            {
                Definition = _deck.Definition
            };

            foreach (var button in emptyController.Definition.BoolButtons)
            {
                emptyController[button] = false;
            }

            return(emptyController);
        }
    public SimpleMessage GetMoveMessage()
    {
        SimpleController controller = this.character.GetComponent <SimpleController>();

        if (controller != null)
        {
            float         moveX   = controller.GetCurrentMoveX();
            float         moveZ   = controller.GetCurrentMoveZ();
            SimpleMessage message = new SimpleMessage(MessageType.PlayerInput);
            message.SetMoveFloats(moveX, moveZ);
            return(message);
        }
        return(null);
    }
Esempio n. 21
0
        public void Homepage_Recognizes_Previous_Visitor()
        {
            // Arrange
            var controller = new SimpleController();
            var mocks      = new ContextMocks(controller);

            controller.Request.Cookies.Add(new HttpCookie("HasVisitedBefore", bool.TrueString));

            // Act
            ViewResult result = controller.Homepage();

            // Assert (this time, demonstrating NUnit's alternative "constraint" syntax)
            Assert.That(result.ViewName, Is.EqualTo("HomePage") | Is.Empty);
            Assert.That((bool)result.ViewData["IsFirstVisit"], Is.False);
        }
Esempio n. 22
0
        public override void InitDeviceResources(GraphicsDevice device)
        {
            base.InitDeviceResources(device);
            _animators = new AnimatorList(StaticActor.Model);
            /// All animators in the stack should have the same set of animations.
            AnimationInstance animator = _animators.Sample;

            // TODO (****)  Do we need this check???
            if (animator.HasAnimation("full_running"))
            {
                // Add individual animations to blend controller.
                idleController = SimpleController.TryMake(animator, "full_running");
                SetAnimation(idleController);
            }
        }
Esempio n. 23
0
	void Start(){
		wiicontroller = GetComponent<WiiController> ();
		simplecontroller = GetComponent<SimpleController> ();
		wiidblcontroller = GetComponent<WiiDoubleCtrl> ();
		mouselookmod = gameObject.GetComponentInChildren<MouseLookMod> ();
		thrustersound = GameObject.Find("Thrusters").GetComponent<ThrusterSound>();
		totTime = timer;


		logdead = false;

		//InvokeRepeating ("logPlayer", 1f, 1f);
		//dead = false;
		log = GetComponent<Log> ();
	}
Esempio n. 24
0
        void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.CompareTag("VehicleTeam0") || other.gameObject.CompareTag("VehicleTeam1"))
            {
                SimpleController scriptController = other.gameObject.GetComponent <SimpleController>();

                if (scriptController.inTunnel == 0)
                {
                    scriptController.inTunnel = 1;
                    GameObject.Find("MainCamera").GetComponent <MotionBlur>().enabled = true;
                    scriptController.targetWayPoint = null;
                    scriptController.reverseTunnel  = reverse;
                    scriptController.wayPointList   = listPoints;
                }
            }
        }
Esempio n. 25
0
        public void Homepage_Recognizes_New_Visitor_And_Sets_Cookie()
        {
            // Arrange
            var controller = new SimpleController();
            var mocks      = new ContextMocks(controller); // Sets up complete mock context

            // Act
            ViewResult result = controller.Homepage();

            // Assert
            Assert.IsEmpty(result.ViewName);
            Assert.IsTrue((bool)result.ViewData["IsFirstVisit"]);
            Assert.AreEqual(1, controller.Response.Cookies.Count);
            Assert.AreEqual(bool.TrueString,
                            controller.Response.Cookies["HasVisitedBefore"].Value);
        }
Esempio n. 26
0
        public static ControllerContext CreateControllerContext()
        {
            var httpRequest  = new HttpRequest("FILENAME", "http://localhost/", "QUERYSTRING");
            var httpResponse = new HttpResponse(new StringWriter());

            var routeData = new RouteData();

            routeData.Values.Add("controller", "CONTROLLER");

            var httpContext        = new HttpContext(httpRequest, httpResponse);
            var httpContextWrapper = new HttpContextWrapper(httpContext);
            var controller         = new SimpleController();

            var controllerContext = new ControllerContext(httpContextWrapper, routeData, controller);

            return(controllerContext);
        }
Esempio n. 27
0
        public void GenerateLogEntry_ExclamationForUnknownButtons()
        {
            var controller = new SimpleController
            {
                Definition = new ControllerDefinition
                {
                    BoolButtons = new List <string> {
                        "Unknown Button"
                    }
                },
                ["Unknown Button"] = true
            };

            var lg     = new Bk2LogEntryGenerator("NES", controller);
            var actual = lg.GenerateLogEntry();

            Assert.AreEqual("|!|", actual);
        }
Esempio n. 28
0
        private void ImportTextFrame(string line)
        {
            // Yabause only supported 1 controller
            var controllers = new SimpleController
            {
                Definition = new ControllerDefinition
                {
                    Name        = "Saturn Controller",
                    BoolButtons = new List <string>
                    {
                        "Reset", "Power", "Previous Disk", "Next Disk", "P1 Left", "P1 Right", "P1 Up", "P1 Down", "P1 Start", "P1 A", "P1 B", "P1 C", "P1 X", "P1 Y", "P1 Z", "P1 L", "P1 R"
                    }
                }
            };

            // Split up the sections of the frame.
            var sections = line.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);

            if (sections.Length != 2)
            {
                Result.Errors.Add("Unsupported input configuration");
                return;
            }

            if (sections[0][0] == '1')
            {
                controllers["Reset"] = true;
            }

            var buttonNames = controllers.Definition.ControlsOrdered.Skip(1).First().ToList();

            // Only count lines with that have the right number of buttons and are for valid players.
            if (sections[1].Length == buttonNames.Count)
            {
                for (int button = 0; button < buttonNames.Count; button++)
                {
                    // Consider the button pressed so long as its spot is not occupied by a ".".
                    controllers[buttonNames[button]] = sections[1][button] != '.';
                }
            }

            // Convert the data for the controllers to a mnemonic and add it as a frame.
            Result.Movie.AppendFrame(controllers);
        }
Esempio n. 29
0
        void OnTriggerExit(Collider other)
        {
            if (other.gameObject.CompareTag("VehicleTeam0") || other.gameObject.CompareTag("VehicleTeam1"))
            {
                SimpleController scriptController = other.gameObject.GetComponent <SimpleController>();
                if (scriptController.currentWayPoint <= 0 || scriptController.currentWayPoint > 14)
                {
                    GameObject.Find("MainCamera").GetComponent <MotionBlur>().enabled = false;
                }

                /*print (other.gameObject.name + " uscito");
                 *
                 * if (other.gameObject.CompareTag ("VehicleTeam0") || other.gameObject.CompareTag ("VehicleTeam1")) {
                 *  Tunnel tunnelScript = endTunnel.GetComponent<Tunnel>();
                 *  if(tunnelScript.                     || scriptController.currentWayPoint < scriptController.wayPointList.transform.childCount
                 *  SimpleController scriptController = other.gameObject.GetComponent<SimpleController> ();
                 *  scriptController.inTunnel = 0;*/
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Load up our animations and bind to the given model.
        /// </summary>
        /// <param name="sro"></param>
        private void LoadAnimations(FBXModel sro)
        {
            Debug.Assert(SharedAnim != null, "Must set SharedAnim to class's shared animation in constructor.");
            if (SharedAnim.ActiveAnimator == null)
            {
                SharedAnim.ActiveAnimator = new AnimatorList(sro);
            }
            _animators = SharedAnim.ActiveAnimator;
            AnimatorList      animList = SharedAnim.ActiveAnimator;
            AnimationInstance animator = animList.Sample;

            if (animator != null && animator.HasAnimation(SharedAnim.ActiveName))
            {
                if (SharedAnim.ActiveController == null)
                {
                    SharedAnim.ActiveController = SimpleController.TryMake(animator, SharedAnim.ActiveName);
                    AnimActive();
                }
            }
            else
            {
                animList.ApplyController(null);
            }
            if (SharedAnim.IdleAnimator == null)
            {
                SharedAnim.IdleAnimator = new AnimatorList(sro);
                AnimationInstance sharedIdle = SharedAnim.IdleAnimator.Sample;
                if ((sharedIdle != null) && sharedIdle.HasAnimation(SharedAnim.IdleName))
                {
                    SharedAnim.IdleController = SimpleController.TryMake(
                        sharedIdle,
                        SharedAnim.IdleName);
                }
                if (SharedAnim.IdleController != null)
                {
                    AnimIdle();
                }
                else
                {
                    SharedAnim.IdleAnimator = null;
                }
            }
        }
Esempio n. 31
0
    // Use this for initialization
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        // Initialize our variables
        boids                 = new List <Boid>();
        obstacles             = new List <Obstacle>();
        boidGameObjectMap     = new Dictionary <Boid, GameObject>();
        obstacleGameObjectMap = new Dictionary <Obstacle, GameObject>();
        source                = GetComponent <AudioSource>();

        // Create parent objects for the boids and obstalces
        boidsGo = new GameObject("Boids");
        boidsGo.transform.SetParent(transform);
        obstalcesGo = new GameObject("Obstacles");
        obstalcesGo.transform.SetParent(transform);
        vfxGo = new GameObject("VFX");
        vfxGo.transform.SetParent(transform);

        // Add boids
        for (int i = 0; i < flockSize; i++)
        {
            AddBoid(new Boid(Vector3.zero));
        }

        // Populate the map with some initial obstacles
        if (startingObstacles != null)
        {
            foreach (StartingObstacle obs in startingObstacles)
            {
                AddObstacle(new Obstacle(new Vector3(obs.x, 0, obs.y)));
            }
        }

        initialized = true;
    }
Esempio n. 32
0
	// Use this for initialization
	void Start ()
	{
		Player = PlayerController.Instance;
		InputController = SimpleController.Instance;
		Mountain = Mountain.Instance;
	}
Esempio n. 33
0
        public void ValidateModelWithInvalidModel() {
            // Arrange
            Controller controller = new SimpleController();
            TryValidateModelModel model = new TryValidateModelModel { IntegerProperty = 5 };

            // Act & Assert
            ExceptionHelper.ExpectInvalidOperationException(
                () => controller.ValidateModel(model, "Prefix"),
                "The model of type '" + model.GetType().FullName + "' is not valid.");

            Assert.AreEqual("Out of range!", controller.ModelState["Prefix.IntegerProperty"].Errors[0].ErrorMessage);
        }
Esempio n. 34
0
        public void ValidateModelWithValidModel() {
            // Arrange
            Controller controller = new SimpleController();
            TryValidateModelModel model = new TryValidateModelModel { IntegerProperty = 15 };

            // Act
            controller.ValidateModel(model);

            // Assert
            Assert.IsTrue(controller.ModelState.IsValid);
        }
Esempio n. 35
0
        public void ValidateModelGuardClauses() {
            // Arrange
            Controller controller = new SimpleController();

            // Act & Assert
            ExceptionHelper.ExpectArgumentNullException(
                () => controller.ValidateModel(null),
                "model");
        }
Esempio n. 36
0
        public void TryValidateModelWithInvalidModel() {
            // Arrange
            Controller controller = new SimpleController();
            TryValidateModelModel model = new TryValidateModelModel { IntegerProperty = 5 };

            // Act
            bool result = controller.TryValidateModel(model, "Prefix");

            // Assert
            Assert.IsFalse(result);
            Assert.AreEqual("Out of range!", controller.ModelState["Prefix.IntegerProperty"].Errors[0].ErrorMessage);
        }
Esempio n. 37
0
        public void ExecuteDoesNotCallTempDataLoadOrSave() {
            // Arrange
            TempDataDictionary tempData = new TempDataDictionary();
            ViewContext viewContext = new ViewContext { TempData = tempData };
            RouteData routeData = new RouteData();
            routeData.DataTokens[ControllerContext.PARENT_ACTION_VIEWCONTEXT] = viewContext;
            routeData.Values["action"] = "SimpleAction";
            RequestContext requestContext = new RequestContext(HttpContextHelpers.GetMockHttpContext().Object, routeData);
            // Strict == no default implementations == calls to Load & Save are not allowed
            Mock<ITempDataProvider> tempDataProvider = new Mock<ITempDataProvider>(MockBehavior.Strict);
            SimpleController controller = new SimpleController();
            controller.ValidateRequest = false;

            // Act
            ((IController)controller).Execute(requestContext);

            // Assert
            tempDataProvider.Verify();
        }
Esempio n. 38
0
        public void ValidateModelGuardClauses()
        {
            // Arrange
            Controller controller = new SimpleController();

            // Act & Assert
            Assert.ThrowsArgumentNull(
                () => controller.ValidateModel(null),
                "model");
        }
 private CommandProcessor CreateInvokerWithSimpleController()
 {
     simpleController = new SimpleController();
     var objects = new[] { simpleController };
     var actionInvoke = new CommandProcessor(objects);
     return actionInvoke;
 }
Esempio n. 40
0
	void Awake()
	{
		Instance = this;
	}
		public void CreateObjects()
		{
			controller = new SimpleController();
			testContext = new TestContext(new UrlInfo("area", "controller", "index"));
		}