예제 #1
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadString()
 {
     Init("A\0SFString\0ATest");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.StringField), field);
     Assert.AreEqual("ATest", ((Connect.StringField)field).Value);
 }
예제 #2
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadInteger()
 {
     Init("A\0SFInt\042\n");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.IntField), field);
     Assert.AreEqual(42, ((Connect.IntField)field).Value);
 }
예제 #3
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadDouble()
 {
     Init("A\0SFDouble\01.2\n");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.DoubleField), field);
     Assert.AreEqual(1.2, ((Connect.DoubleField)field).Value, 0.00001);
 }
예제 #4
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadBool()
 {
     Init("A\0SFBool\01\n");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.BoolField), field);
     Assert.AreEqual(true, ((Connect.BoolField)field).Value);
 }
예제 #5
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadMultiString()
 {
     Init("A\0MFString\0ATest\0Another Test\n");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.MultiStringField), field);
     string[] value_ = { "ATest", "Another Test" };
     Assert.AreEqual(value_, ((Connect.MultiStringField)field).Value);
 }
예제 #6
0
파일: TestFields.cs 프로젝트: wobakj/avango
 public void ReadMultiVec3()
 {
     Init("A\0MFVec3\01.1\01.2\01.3\02.1\02.2\02.3\n");
     Connect.Field field = connection.Read();
     Assert.AreEqual("A", field.Name);
     Assert.IsInstanceOfType(typeof(Connect.MultiVec3Field), field);
     double[,] value_ = { { 1.1, 1.2, 1.3 }, { 2.1, 2.2, 2.3 } };
     AssertVectorsAreEqual(value_, ((Connect.MultiVec3Field)field).Value);
 }
예제 #7
0
파일: TestFields.cs 프로젝트: wobakj/avango
    public void ReadFieldsFromFile()
    {
        StreamReader reader = new StreamReader(Environment.GetEnvironmentVariable("TEST_DATA_PATH") + "/fielddata", new ASCIIEncoding());

        Connect.Connection connection = new Connect.Connection(reader, writer);

        Connect.Field field = connection.Read();
        Assert.AreEqual("A", field.Name);
        Assert.IsInstanceOfType(typeof(Connect.IntField), field);
        Assert.AreEqual(42, ((Connect.IntField)field).Value);

        field = connection.Read();
        Assert.AreEqual("B", field.Name);
        Assert.IsInstanceOfType(typeof(Connect.StringField), field);
        Assert.AreEqual("Another one.", ((Connect.StringField)field).Value);

        field = connection.Read();
        Assert.AreEqual("C", field.Name);
        Assert.IsInstanceOfType(typeof(Connect.MultiStringField), field);
        string[] value_ = { "Another one.", "Two" };
        Assert.AreEqual(value_, ((Connect.MultiStringField)field).Value);
    }
예제 #8
0
 public void Write(Field field)
  {
   WriteHeader(field);
   WriteBody(field);
   Flush();
  }
예제 #9
0
 void WriteBody(Field field)
  {
   field.Write(writer);
  }
예제 #10
0
 void WriteHeader(Field field)
  {
   writer.Write(field.Name);
   writer.Write("\0");
  }