예제 #1
0
        public SceneBase CreateObjectTest(Observer.ISceneObserver obs)
        {
            SceneBase scene = new ObjectTest();

            scene.RegisterObserver(obs);
            return(scene);
        }
        public void ObjTest()
        {
            //Arrange
            Dobrovoljac ocekivani = new Dobrovoljac();

            ocekivani.naziv = ocekivani.naziv.ToUpper(); //Klasa koju testiramo ima
                                                         //bukvalno isto ovo,
                                                         //samo uzme objekat klase
                                                         //Dobrivoljac i baci ga u CAPS :)

            ObjectTest t = new ObjectTest();

            //Act
            Dobrovoljac rezultat = t.CAPS(new Dobrovoljac());

            //Assert
            //Ovaj Equals ovde moze da bude problematican. Ako mi nismo implementirali
            //nasu verziju, pozvace se implementacija od klase objekat. Ona je izrazito
            //uska i puno manje je equals, vise je same, jer je jedini nacin da naterate
            //objA.Equals(objB), u slucaju te klase, da baci true taj da mu date da poredi
            //ne jednake objekte nego isti objekat. objA.Equals(objB) bude tacno samo ako smo
            //izvrsili objA = objB, da oba imena pokazuju na potpuno isti objekat, sve drugo je
            //false
            //Imamo i Assert.AreSame koji radi bas to, tj true je ne ako objektov equals vrati
            //true nego samo u slucaju da i ocekivani i rezultat pokuzaju na isti,
            //jedan jedini, objekat.
            Assert.AreEqual(ocekivani, rezultat);
        }
예제 #3
0
        //[MenuItem("Editors/LiumkTest/123123")]
        static void ShowEditor()
        {
            //EditorUtility.DisplayDialog("MyTool", "Do It in C# !", "OK", "");
            if (s_instance == null)
            {
                //Type[] types = new Type[2] { typeof(BlackWood.NodeCanvas.Editor.SkinContainer), typeof(BlackWood.NodeCanvas.Editor.BBPContainer) };
                //s_instance = GetWindow<ZEditor>("Unit Browser", true, types);
                s_instance = GetWindow <ZEditor>(false, "ZEditor");
            }
            //s_instance.Show();
            s_instance.Show();

            var testObject = new ObjectTest();
            var writer     = new LitJson.JsonWriter {
                PrettyPrint = true
            };

            LitJson.JsonMapper.ToJson(testObject, writer);

            string path = "./Assets/test.json";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            File.WriteAllText(path, writer.ToString(), Encoding.UTF8);
        }
예제 #4
0
 public MainWindow()
 {
     InitializeComponent();
     MyProperty = "Hello";
     MyObject   = new ObjectTest {
         MyProperty = "Hello"
     };
 }
예제 #5
0
        public void HasId_TwoObject_NotEqual()
        {
            // arrange
            var newValueObject = new ObjectTest("NotEqual");

            // act

            // assert
            Assert.IsFalse(valueObject.Equals(newValueObject));
            Assert.IsTrue(valueObject != newValueObject);
        }
예제 #6
0
        public void Add_AddObject_GetSpecificInfo()
        {
            //arrange
            AList <ObjectTest> listOfValues = new AList <ObjectTest>();
            ObjectTest         test         = new ObjectTest(2, "merfsack");

            //act
            listOfValues.Add(test);
            //assert
            Assert.AreEqual(listOfValues[0].name, "merfsack");
        }
    private void MakeExecuters()
    {
        GameObjectList = new List <ObjectTest>();

        for (int i = 0; i < TestList.Count; i++)
        {
            ObjectTest person = ((GameObject)Instantiate(TestObject, new Vector3(0, 0, 0), Quaternion.identity)).GetComponent <ObjectTest>();
            person.SetupTest(TestList[i]);
            GameObjectList.Add(person);
        }
    }
예제 #8
0
        public void HasId_TwoObject_AreEqual()
        {
            // arrange
            var newValueObject = new ObjectTest(value);

            // act

            // assert
            Assert.IsTrue(valueObject.Equals(newValueObject));
            Assert.IsTrue(valueObject == newValueObject);
        }
예제 #9
0
        public void Remove_RemoveObject_ObjectIsGone()
        {
            //arrange
            ObjectTest         test         = new ObjectTest(3, "remove me");
            AList <ObjectTest> listOfValues = new AList <ObjectTest>();// { "test", removeThis, "fill" };

            listOfValues.Add(test);
            //act
            listOfValues.Remove(test);
            //assert
            Assert.AreNotEqual(listOfValues[0], test);
        }
        public void ChangeValueTest()
        {
            bool called = false;
            PropertyChangedEventArgs epc = null;
            ObjectTest tst = new ObjectTest();

            tst.PropertyChanged += (s, e) => { called = true; epc = e; };
            tst.Value            = 10;

            Assert.IsTrue(called);
            Assert.AreEqual("Value", epc.PropertyName);
            Assert.AreEqual(10, tst.Value);
        }
    static void Main()
    {
        object a;
          a = 1;   // an example of boxing
          Console.WriteLine(a);
          Console.WriteLine(a.GetType());
          Console.WriteLine(a.ToString());

          a = new ObjectTest();
          ObjectTest classRef;
          classRef = (ObjectTest)a;
          Console.WriteLine(classRef.i);
    }
예제 #12
0
    static void Main()
    {
        object a;

        a = 1; // an example of boxing
        Console.WriteLine(a);
        Console.WriteLine(a.GetType());
        Console.WriteLine(a.ToString());

        a = new ObjectTest();
        ObjectTest classRef;

        classRef = (ObjectTest)a;
        Console.WriteLine(classRef.i);
    }
예제 #13
0
파일: Program.cs 프로젝트: emacslisp/cs
        static void Main(string[] args)
        {
            Dictionary <ObjectTest, DateTime> dt = new Dictionary <ObjectTest, DateTime>(new FooEqualityComparer());
            ObjectTest obt1 = new ObjectTest(1, 2);

            dt.Add(obt1, DateTime.Now);
            ObjectTest obt2 = new ObjectTest(1, 2);

            if (obt1.GetHashCode() == obt2.GetHashCode())
            {
            }
            if (dt.ContainsKey(obt2))
            {
                Console.WriteLine("Two Objects are Same Now");
            }
        }
예제 #14
0
        protected override void Run()
        {
            try
            {
                mDebugger.Send("Run");

                //// C#
                ObjectTest.Execute();
                WhileLoopTests.Execute();
                ForeachLoopTests.Execute();

                //mDebugger.Send("Thread test start of 500 ms");
                //ThreadTest.Execute();
                //mDebugger.Send("Thread test end");

                SpanTest.Execute();
                //DecimalTest.Execute();
                BitConverterTest.Execute();
                UnsafeCodeTest.Execute();
                DelegatesTest.Execute();
                EventsTest.Execute();
                RandomTests.Execute();
                ConvertTests.Execute();

                // System.Collections
                HashtableTest.Execute();

                // System.Collections.Generic
                ListTest.Execute();
                QueueTest.Execute();
                DictionaryTest.Execute();

                // System.Text
                StringBuilderTest.Execute();
                EncodingTest.Execute();

                TestController.Completed();
            }
            catch (Exception e)
            {
                mDebugger.Send("Exception occurred: " + e.Message);
                mDebugger.Send(e.Message);
                Console.WriteLine("Exception occurred");
                Console.WriteLine(e.Message);
                TestController.Failed();
            }
        }
    private void Categorize()
    {
        //TestList.Sort();
        TestList.RemoveAt(2);
        for (int i = 0; i < GameObjectList.Count; i++)
        {
            GameObject.Destroy(GameObjectList[i].gameObject);
        }
        MakeExecuters();
        NewTest DoubleTrail = TestList[0];

        TestList.Add(DoubleTrail);
        ObjectTest person = ((GameObject)Instantiate(TestObject, new Vector3(0, 0, 0), Quaternion.identity)).GetComponent <ObjectTest>();

        person.SetupTest(TestList[TestList.Count - 1]);
        GameObjectList.Add(person);
        for (int i = 0; i < TestList.Count; i++)
        {
            TestList[i].Speak();
        }
    }
예제 #16
0
파일: DataList.cs 프로젝트: simonep77/bdo
        /// <summary>
        /// Ritorna una lista di oggetti che rispondono true al delegato passato in input
        /// </summary>
        /// <param name="testFunc"></param>
        /// <returns></returns>
        public TL FindAllByDelegate(ObjectTest <T> testFunc)
        {
            //Verifica delegato
            if (testFunc == null)
            {
                throw new ObjectException(Resources.ObjectMessages.List_NullDelegate, typeof(T).Name);
            }

            TL oListRet = this.Slot.CreateList <TL>();

            int iLen = this.Count;

            for (int i = 0; i < iLen; i++)
            {
                if (testFunc(this[i]))
                {
                    oListRet.Add(this.mInnerList[i]);
                }
            }

            //Ritorna Lista
            return(oListRet);
        }
        public void ExtendedChangeValueTest()
        {
            bool called = false;
            PropertyChangedEventArgs epc = null;
            ObjectTest tst = new ObjectTest()
            {
                Value = 10
            };

            tst.PropertyChanged += (s, e) => { called = true; epc = e; };
            tst.Value            = 20;

            Assert.IsTrue(called);
            Assert.AreEqual(20, tst.Value);
            Assert.IsInstanceOfType(epc, typeof(PropertyChangedEventArgsEx));

            var epcx = (PropertyChangedEventArgsEx)epc;

            Assert.AreEqual(10, (int)epcx.OldValue);
            Assert.AreEqual(20, (int)epcx.NewValue);
            Assert.IsTrue(epcx.HasNewValue);
            Assert.IsTrue(epcx.HasOldValue);
        }
예제 #18
0
 public ConditionalAttribute(string valueSource, ObjectTest test) : base(TestPhase, 0)
 {
     ValueSource = valueSource;
     ObjectTest  = test;
     Type        = TestType.Object;
 }
예제 #19
0
 private static void UpdateObjectVisibility(VisualElement element, Object value, ObjectTest test)
 {
     element.SetDisplayed((value && test == ObjectTest.ShowIfSet) || (!value && test == ObjectTest.ShowIfNotSet));
 }