Inheritance: MonoBehaviour
Example #1
0
        public void WhenAddingValidatingResultsWithNoMemberAndDefaultKey_ThenControllerShouldHaveModelErrors()
        {
            var controller = new ControllerTest();

            ControllerExtensions.AddModelErrors(controller, new List <ValidationResult> {
                new ValidationResult("msg")
            }, "test");

            Assert.True(controller.ModelState["test"].Errors.Count == 1);
            Assert.True(controller.ModelState["test"].Errors[0].ErrorMessage == "msg");
        }
        public void WhenAddingValidatingResultsWithNoMemberAndDefaultKey_ThenControllerShouldHaveModelErrors()
        {
            var controller = new ControllerTest();

            ControllerExtensions.AddModelErrors(controller, new List<ValidationResult> {
                new ValidationResult("msg")
            }, "test");

            Assert.True(controller.ModelState["test"].Errors.Count == 1);
            Assert.True(controller.ModelState["test"].Errors[0].ErrorMessage == "msg");
        }
Example #3
0
        public void TestDispose01()
        {
            IController controller = new ControllerTest();

            //test call
            controller.Dispose();

            //post check
            Accessor controllerAccessor = ReflectionAccessor.Wrap(controller);
            bool     disposedValue      = (bool)controllerAccessor.GetField("m_disposed");

            Assert.IsTrue(disposedValue);

            //second call to Dispose
            controller.Dispose();
        }
Example #4
0
        static void Main(string[] args)
        {
            PCMemberTests tests = new PCMemberTests();

            tests.RunAllTests(); // call all tests



            RepositoryConference repoConf = new RepositoryConference();
            //repoConf.add(new Conference("nume1", DateTime.Now, "ed1"));
            //repoConf.add(new Conference("nume2", DateTime.Now, "ed1"));
            //repoConf.add(new Conference("nume3", DateTime.Now, "ed1"));
            RepositoryArticle     repoArticle     = new RepositoryArticle();
            RepositoryAuthor      repoAuthor      = new RepositoryAuthor();
            RepositoryPCMember    repoPCM         = new RepositoryPCMember();
            RepositorySection     repoSection     = new RepositorySection();
            RepositoryUser        repoUser        = new RepositoryUser();
            RepositoryReviewer    repoReviewer    = new RepositoryReviewer();
            RepositoryParticipant repoParticipant = new RepositoryParticipant();
            RepositoryReview      repoReview      = new RepositoryReview();
            var serviceServer = new ServiceServerImpl(repoConf, repoArticle, repoSection, repoUser, repoAuthor, repoPCM, repoReviewer, repoParticipant, repoReview);
            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();

            serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
            IDictionary props = new Hashtable();

            props["port"] = 55555;
            TcpChannel channel = new TcpChannel(props, clientProv, serverProv);

            ChannelServices.RegisterChannel(channel, false);

            RemotingServices.Marshal(serviceServer, "Conference");
            //Controller tests
            ControllerTest ctrTest = new ControllerTest();

            //ctrTest.getConferenceIdFromNameTest();
            ctrTest.RunAll();

            Console.WriteLine("Server started ...");
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Example #5
0
        static void testing()
        {
            ArrayListTest arr = new ArrayListTest();

            arr.Init();
            ArrayDictTest dic = new ArrayDictTest();

            dic.Init();
            ArrayStackTest stk = new ArrayStackTest();

            stk.Init();
            CompStmtTest cstm = new CompStmtTest();

            cstm.Init();
            AssignStmtTest astm = new AssignStmtTest();

            astm.Init();
            PrintStmtTest pstm = new PrintStmtTest();

            pstm.Init();
            IfStmtTest istm = new IfStmtTest();

            istm.Init();
            ArithExprTest aexp = new ArithExprTest();

            aexp.Init();
            ConstExprTest cexp = new ConstExprTest();

            cexp.Init();
            VarExprTest vexp = new VarExprTest();

            vexp.Init();
            ProgStateTest prg = new ProgStateTest();

            prg.Init();
            RepositoryTest rep = new RepositoryTest();

            rep.Init();
            ControllerTest ctr = new ControllerTest();

            ctr.Init();
        }
Example #6
0
        public void TestDeattach01()
        {
            //Initial setup
            IController controller = new ControllerTest();

//             view = new ViewTest();
//             view.ViewType = ViewTest.ViewTestType;
//             model = new ModelTest();
//             controller.Attach(model, view);

            //test call
            controller.Deattach();

            //post Condition check
            Accessor controllerAccessor = ReflectionAccessor.Wrap(controller);

            Assert.IsNull(controllerAccessor.GetField("m_View"));
            Assert.IsNull(controllerAccessor.GetField("m_Model"));

            Accessor notifyManagerAccessor = ReflectionAccessor.Wrap(NotifyManager.GetInstance());
            Dictionary <IObserver, IObserver> observerMap = (Dictionary <IObserver, IObserver>)notifyManagerAccessor.GetField("m_ObserverMap");

            Assert.IsFalse(observerMap.ContainsKey(controller));
        }
 void Start()
 {
     myController = GetComponent<ControllerTest>();
 }
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Debug.WriteLine("On Create");
            RetainInstance = true;

            var    dslr = new DataSetLocationResolver();
            string url, id;

            dslr.ResolveFromToken("go.yn-hk1", out url, out id);

            Debug.WriteLine("URL is :" + url);
            Debug.WriteLine("Id is :" + id);

            try
            {
                var ct = new ControllerTest(((MainActivity)Activity).Ctrl);

                //ct.TestListOfProjects();
                //ct.TestRecentTasks();
                //ct.TestListOfTasks();
                //ct.TestSingleTask();
                //                ct.TestListOfTimeLogs();
                //                ct.TestListOfTimeLogsWithMaxResults();
                //                ct.TestListOfTimeLogsWithprojectId();
                //                ct.TestListOfTimeLogsWithstartDateFrom();
                //                ct.TestListOfTimeLogsWithstartDateTo();
                ct.TestListOfTimeLogsWithtaskId();
                //ct.TestAddATimeLog();

                //ct.TestGetATimeLog("-71");
                //ct.TestDeleteATimeLog(-71);

                string tid = "-87";
                //ct.TestUpdateATimeLogUpdateComment(tid);
                //ct.TestUpdateATimeLogUpdateInterruptTimeNotOpen(tid);
                ct.TestUpdateATimeLogUpdateLoggedTime(tid);
                // ct.TestUpdateATimeLogUpdateStartDate(tid);
                //ct.TestUpdateATimeLogUpdateTaskId(tid);
                //ct.TestUpdateATimeLogUpdateInterruptTime(tid);
                //ct.TestUpdateATimeLogUpdateLoggedTimeNotOpen(tid);
                // ct.TestUpdateEstimatedTime("330", 125);
                //ct.TestMarkTaskComplete("330");
                // ct.TestMarkTaskIncomplete("330");
            }
            catch (CannotReachServerException)
            {
                Debug.WriteLine("Unable to connect to network");
            }
            catch (CancelTimeLoggingException)
            {
                // Add this when needed
                Debug.WriteLine("Cancel Time Logging Right now");
            }
            catch (StatusNotOkayException)
            {
                Debug.WriteLine("Status Not Okay!!");
            }
            catch (Exception)
            {
                // For any other weird exceptions
                Debug.WriteLine("Some other weird exception");
            }

            // Create your fragment here
        }
Example #9
0
 // Use this for initialization
 void Start()
 {
     controller = GetComponent <ControllerTest>();
 }
Example #10
0
 private void Start()
 {
     CT             = GameObject.FindWithTag("CT").GetComponent <ControllerTest>();
     LeftStickHalf  = LeftStickBTN.rectTransform.sizeDelta.x / 2;
     RightStickHalf = RightStickBTN.rectTransform.sizeDelta.x / 2;
 }
Example #11
0
 void Awake()
 {
     Instance = this;
 }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     joystick  = FindObjectOfType <Joystick>();
     joybutton = FindObjectOfType <ControllerTest>();
 }