示例#1
0
        public void ComputerName_ToString_SetProperty_Expect_SetName()
        {
            //--------------------Arrange--------------------
            var testName = "TestComputerName";

            var computerNames = new ComputerName();

            //--------------------Act------------------------
            computerNames.Name = testName;
            //--------------------Assert---------------------
            Assert.AreEqual(testName, computerNames.Name);
            Assert.AreEqual(testName, computerNames.ToString());
        }
        public void ToStringTest( )
        {
            ComputerName withAlias = new ComputerName( "1.1.1.1", "alias" );
            Assert.AreEqual( "alias", withAlias.ToString() );

            ComputerName withoutAlias = new ComputerName( "work", null );
            Assert.AreEqual( "work", withoutAlias.ToString() );

            // Do we treat empty string as null?
            ComputerName emptyAlias = new ComputerName( "afar", "" );
            Assert.AreEqual( "afar", emptyAlias.ToString() );
        }
示例#3
0
 public override string ToString()
 {
     return(ComputerName.ToString());
 }