public void Constructor_ExpectedValues()
        {
            // Setup
            var random           = new Random(21);
            var failureMechanism = new PipingStructureFailureMechanism
            {
                InAssembly = random.NextBoolean()
            };

            // Call
            var properties = new PipingStructureFailureMechanismProperties(failureMechanism);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <PipingStructureFailureMechanism> >(properties);
            Assert.AreEqual(failureMechanism.Name, properties.Name);
            Assert.AreEqual(failureMechanism.Code, properties.Code);
            Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly);

            GeneralInput generalInput = failureMechanism.GeneralInput;

            Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
            Assert.AreEqual(generalInput.N,
                            properties.N,
                            properties.N.GetAccuracy());
            Assert.AreEqual(generalInput.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection);
        }
예제 #2
0
        /* Is User Admin*/
        public RequestOutput GetIsUserAdmin(GeneralInput input)
        {
            var query = _roleManager.Roles;
            var roles = query.ToList();

            var requestOutput = new RequestOutput();

            foreach (var role in roles)
            {
                if (role.Name.ToLower() == "admin")
                {
                    var userInputDto = new GetUsersInput();
                    userInputDto.Filter = input.UserName;
                    userInputDto.Role   = role.Id;

                    var queryUser = UserManager.Users
                                    .Where(u => u.Roles.Any(r => r.RoleId == role.Id))
                                    .WhereIf(!input.UserName.IsNullOrWhiteSpace(), u => u.UserName.Contains(input.UserName));

                    var userCount = queryUser.Count();

                    if (userCount > 0)
                    {
                        requestOutput.Status = true;
                    }
                    requestOutput.StatusMessage = "SUCCESS";
                    break;
                }
            }

            return(requestOutput);
        }
예제 #3
0
    void Update()
    {
        transform.position = Vector3.MoveTowards(transform.position, transform.position + Vector3.forward, playerSpeed);

        if (inputX.IsInput())
        {
            isGameStarted = true;

            GeneralInput gInput = inputX.GetInput(0);

            if (gInput.phase == IPhase.Began || gInput.phase == IPhase.Stationary || gInput.phase == IPhase.Ended || gInput.phase == IPhase.Canceled)
            {
                touchStartPos = gInput.currentPosition;
            }
            else
            {
                Vector2 touchAlpha = gInput.currentPosition - touchStartPos;
                if (touchAlpha.x > 1f && !moveHandsToRight)
                {
                    moveHandsToRight = true;
                    moveHandsToLeft  = false;
                }
                else if (touchAlpha.x < -1f && !moveHandsToLeft)
                {
                    moveHandsToLeft  = true;
                    moveHandsToRight = false;
                }
            }
        }
    }
예제 #4
0
 private TestCalculatableFailureMechanism(string name, string code, IEnumerable <ICalculation> calculations)
     : base(name, code)
 {
     CalculationsGroup = new CalculationGroup();
     CalculationsGroup.Children.AddRange(calculations);
     GeneralInput = new GeneralInput();
     CalculationsInputComments = new Comment();
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PipingStructureFailureMechanism"/> class.
 /// </summary>
 public PipingStructureFailureMechanism()
     : base(Resources.PipingStructureFailureMechanism_DisplayName, Resources.PipingStructureFailureMechanism_Code)
 {
     GeneralInput = new GeneralInput
     {
         ApplyLengthEffectInSection = false
     };
 }
예제 #6
0
 public void Awake()
 {
     controls   = new GeneralInput();
     mainCamera = transform.GetComponentInChildren <Camera>();
     rigidBody  = transform.GetComponentInChildren <Rigidbody>();
     interactableWithinReach = null;
     Cursor.lockState        = CursorLockMode.Locked;
     alive = true;
 }
예제 #7
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var generalInput = new GeneralInput();

            // Assert
            Assert.AreEqual(2, generalInput.N.NumberOfDecimalPlaces);
            Assert.AreEqual(1.0, generalInput.N, generalInput.N.GetAccuracy());
            Assert.IsFalse(generalInput.ApplyLengthEffectInSection);
        }
예제 #8
0
        public void N_SetValidValue_UpdatesValue(double value)
        {
            // Setup
            var generalInput = new GeneralInput();

            // Call
            generalInput.N = (RoundedDouble) value;

            // Assert
            Assert.AreEqual(2, generalInput.N.NumberOfDecimalPlaces);
            Assert.AreEqual(value, generalInput.N, generalInput.N.GetAccuracy());
        }
예제 #9
0
        public void N_SetValueOutsideValidRange_ThrowArgumentOutOfRangeException(double value)
        {
            // Setup
            var generalInput = new GeneralInput();

            // Call
            void Call() => generalInput.N = (RoundedDouble) value;

            // Assert
            const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen.";
            TestHelper.AssertThrowsArgumentExceptionAndTestMessage<ArgumentOutOfRangeException>(Call, expectedMessage);
        }
예제 #10
0
        /// <summary>
        /// Creates a new instance of <see cref="TestFailureMechanism"/>.
        /// </summary>
        public TestFailureMechanism()
        {
            Name = "Faalmechanisme";
            Code = "NIEUW";

            sectionCollection        = new FailureMechanismSectionCollection();
            InAssembly               = true;
            GeneralInput             = new GeneralInput();
            InAssemblyInputComments  = new Comment();
            InAssemblyOutputComments = new Comment();
            NotInAssemblyComments    = new Comment();
            AssemblyResult           = new FailureMechanismAssemblyResult();
            sectionResults           = new ObservableList <TestFailureMechanismSectionResult>();
        }
        /// <summary>
        /// Read the <see cref="IStandAloneFailureMechanismMetaEntity"/> and use the information to
        /// update the <see cref="GeneralInput"/>.
        /// </summary>
        /// <param name="entity">The <see cref="IStandAloneFailureMechanismMetaEntity"/> to update
        /// <see cref="GeneralInput"/> for.</param>
        /// <param name="generalInput">The <see cref="GeneralInput"/> to update.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        internal static void Read(this IStandAloneFailureMechanismMetaEntity entity, GeneralInput generalInput)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (generalInput == null)
            {
                throw new ArgumentNullException(nameof(generalInput));
            }

            generalInput.N = (RoundedDouble)entity.N;
            generalInput.ApplyLengthEffectInSection = Convert.ToBoolean(entity.ApplyLengthEffectInSection);
        }
예제 #12
0
    void Awake()
    {
        DontDestroyOnLoad(this);
        if (singleton != null)
        {
            Destroy(gameObject);
        }
        else
        {
            singleton = this;
        }

#if UNITY_IOS || UNITY_ANDROID
        input = new MobileInput();
        input.SetMaxTime(m_MaxTime);
        input.SetMinSwipeDistance(m_MinSwipeDistance);
#elif UNITY_STANDALONE_WIN
        input = new PCInput();
#endif
    }
예제 #13
0
    void Update()
    {
        if (inputX.GetInputs() && !DataScript.inputLock)
        {
            GeneralInput gInput = inputX.GetInput(0);

            if (gInput.phase == IPhase.Began)
            {
                Ray        ray = Camera.main.ScreenPointToRay(gInput.currentPosition);
                RaycastHit raycastHit;

                if (Physics.Raycast(ray, out raycastHit))
                {
                    if (raycastHit.transform.gameObject.tag == "Hex")
                    {
                        StartCoroutine(CarryRagdollToNewPos(raycastHit.transform.gameObject));
                    }
                }
            }
        }
    }
예제 #14
0
        public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
        {
            // Setup
            var       mocks                     = new MockRepository();
            var       projectObserver           = mocks.StrictMock <IObserver>();
            const int numberOfChangedProperties = 3;

            projectObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties);
            mocks.ReplayAll();

            var random           = new Random(21);
            var failureMechanism = new SpecificFailureMechanism
            {
                InAssembly = random.NextBoolean()
            };

            // Call
            var properties = new SpecificFailureMechanismProperties(failureMechanism);

            failureMechanism.Attach(projectObserver);

            // Call
            const string  newName = "Some new cool pretty name";
            const string  newCode = "Nieuw Faalmechanisme";
            RoundedDouble newN    = random.NextRoundedDouble(1.0, 20.0);

            properties.Name = newName;
            properties.Code = newCode;
            properties.N    = newN;

            // Assert
            Assert.AreEqual(newName, failureMechanism.Name);
            Assert.AreEqual(newCode, failureMechanism.Code);

            GeneralInput input = failureMechanism.GeneralInput;

            Assert.AreEqual(newN, input.N, input.N.GetAccuracy());

            mocks.VerifyAll();
        }
        public void Read_WithAllData_SetsGeneralInputProperties()
        {
            // Setup
            var random = new Random();
            var mocks  = new MockRepository();
            var entity = mocks.Stub <IStandAloneFailureMechanismMetaEntity>();

            mocks.ReplayAll();

            entity.N = random.NextDouble(1, 20);
            entity.ApplyLengthEffectInSection = Convert.ToByte(random.NextBoolean());
            var generalInput = new GeneralInput();

            // Call
            entity.Read(generalInput);

            // Assert
            Assert.AreEqual(entity.N, generalInput.N, generalInput.N.GetAccuracy());
            Assert.AreEqual(Convert.ToBoolean(entity.ApplyLengthEffectInSection), generalInput.ApplyLengthEffectInSection);

            mocks.VerifyAll();
        }
예제 #16
0
    void Update()
    {
        if(inputX.IsInput())
        {
            GeneralInput gInput = inputX.GetInput(0);
          
            if(gInput.phase == IPhase.Began)
            {
                isTouchEnded = false;
                StartCoroutine(Fire());
                touchStartPos = gInput.currentPosition;
            }
            else if(gInput.phase == IPhase.Ended)
            {
                isTouchEnded = true;

                if(routeFollower!=null)
                    StopCoroutine(routeFollower); //Corountine inputla beraber bitmediginden burada durduruluyor. yukarda alinan input corountine sokuluyor ama sonradan editlenmiyor. 

                coroutineAllowed = true;
                touchDeltaX = 0;
            }
            else
            {
예제 #17
0
    // Use this for initialization
    void Start()
    {
        shop           = GetComponent <PlayerShop> ();
        playerBody     = GetComponent <Rigidbody2D> ();
        networkInfo    = GetComponent <NetSetup> ();
        carryControl   = GetComponent <CarryControl> ();
        anim           = GetComponent <Animator> ();
        gravityInitial = playerBody.gravityScale;
        wallCheck      = GetComponentInChildren <WallCheck> ();
        baitManager    = GetComponent <BaitManager> ();
        string[] controllers = Input.GetJoystickNames();
        foreach (string s in controllers)
        {
            Debug.Log(s);
        }
        if (controllers.Length > 0)
        {
            controllerEnabled = true;
        }
        input = new GeneralInput();
        input.controllerEnabled = controllerEnabled;
//
//		superJumpModeText = GameObject.Find ("PowerJumpMode").GetComponent<Text> ();
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="WaterPressureAsphaltCoverFailureMechanism"/> class.
 /// </summary>
 public WaterPressureAsphaltCoverFailureMechanism()
     : base(Resources.WaterPressureAsphaltCoverFailureMechanism_DisplayName, Resources.WaterPressureAsphaltCoverFailureMechanism_Code)
 {
     GeneralInput = new GeneralInput();
 }
예제 #19
0
 public KeyboardInputActions(GeneralInput wrapper)
 {
     m_Wrapper = wrapper;
 }
예제 #20
0
 public MouseInputActions(GeneralInput wrapper)
 {
     m_Wrapper = wrapper;
 }
예제 #21
0
	// Use this for initialization
	void Start () {
		shop = GetComponent<PlayerShop> ();
		playerBody = GetComponent<Rigidbody2D> ();
		networkInfo = GetComponent<NetSetup> ();
		carryControl = GetComponent<CarryControl> ();
		anim = GetComponent<Animator> ();
		gravityInitial = playerBody.gravityScale;
		wallCheck = GetComponentInChildren<WallCheck> ();
		baitManager = GetComponent<BaitManager> ();
		string[] controllers = Input.GetJoystickNames ();
		foreach (string s in controllers) {
			Debug.Log (s);
		}
		if (controllers.Length > 0) {
			controllerEnabled = true;
		}
		input = new GeneralInput ();
		input.controllerEnabled = controllerEnabled;
//
//		superJumpModeText = GameObject.Find ("PowerJumpMode").GetComponent<Text> ();
	}
 void Awake()
 {
     Debug.Log("General Input Ready");
     controls = new GeneralInput();
     controls.KeyboardInput.SetCallbacks(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GrassCoverSlipOffOutwardsFailureMechanism"/> class.
 /// </summary>
 public GrassCoverSlipOffOutwardsFailureMechanism()
     : base(Resources.GrassCoverSlipOffOutwardsFailureMechanism_DisplayName, Resources.GrassCoverSlipOffOutwardsFailureMechanism_Code)
 {
     GeneralInput = new GeneralInput();
 }
예제 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MicrostabilityFailureMechanism"/> class.
 /// </summary>
 public MicrostabilityFailureMechanism()
     : base(Resources.MicrostabilityFailureMechanism_DisplayName, Resources.MicrostabilityFailureMechanism_Code)
 {
     GeneralInput = new GeneralInput();
 }
예제 #25
0
 private void Awake()
 {
     _controls = new GeneralInput();
     _controls.Player.SetCallbacks(this);
 }
예제 #26
0
 public TestFailureMechanism() : base("Test", "Code")
 {
     GeneralInput = new GeneralInput();
 }