コード例 #1
0
        public void SamplePublicText_GetValueIsExpected_WhenSet()
        {
            // Arrange
            _parentGameObject = new GameObject();
            TemplateComponent templateComponent = _parentGameObject.AddComponent <TemplateComponent>();
            string            text = "MyText";

            // Act
            templateComponent.SamplePublicText = text;

            //  -----------------------------------------------
            // NOTE: This is a silly demo. It offers low value
            //       to unit test a set/get like this.
            //  -----------------------------------------------

            // Assert
            Assert.AreEqual(templateComponent.SamplePublicText, text);
        }
コード例 #2
0
        public IEnumerator SamplePublicText_GetValueIsExpected_1FrameAfterWhenSet()
        {
            // Arrange
            _parentGameObject = new GameObject();
            TemplateComponent templateComponent = _parentGameObject.AddComponent <TemplateComponent>();
            string            text = "MyText";

            // Act
            templateComponent.SamplePublicText = text;

            //  -----------------------------------------------
            // NOTE: This is a silly demo. There is no reason
            //		 to skip a frame here.
            //  -----------------------------------------------

            // Use yield to skip a frame.
            yield return(null);

            // Assert
            Assert.AreEqual(templateComponent.SamplePublicText, text);
        }