summaryrefslogtreecommitdiff
path: root/tests/FlatBuffers.Test
diff options
context:
space:
mode:
authorWouter van Oortmerssen <wvo@google.com>2014-09-19 16:51:36 -0700
committerWouter van Oortmerssen <wvo@google.com>2014-09-22 15:53:19 -0700
commit517c964fe2099ecc0810db33cfd45b406b3f3132 (patch)
tree4b646dbde5cd5b70d4ef92c07d4cbbb27a594c50 /tests/FlatBuffers.Test
parent3f8700b29669855ae440ad67180742ede82b3fb2 (diff)
downloadflatbuffers-517c964fe2099ecc0810db33cfd45b406b3f3132.tar.gz
flatbuffers-517c964fe2099ecc0810db33cfd45b406b3f3132.tar.bz2
flatbuffers-517c964fe2099ecc0810db33cfd45b406b3f3132.zip
Support for required fields.
Change-Id: I560c7ca11b3d665eecafb528f3737b7e139ca9b0 Tested: on Linux and Windows.
Diffstat (limited to 'tests/FlatBuffers.Test')
-rw-r--r--tests/FlatBuffers.Test/FlatBuffers.Test.csproj6
-rw-r--r--tests/FlatBuffers.Test/FlatBuffersExampleTests.cs10
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/FlatBuffers.Test/FlatBuffers.Test.csproj b/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
index 6d7a8def..fd3f61f2 100644
--- a/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
+++ b/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
@@ -66,13 +66,13 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Content Include="..\monsterdata_test.bin">
- <Link>Resources\monsterdata_test.bin</Link>
+ <Content Include="..\monsterdata_test.mon">
+ <Link>Resources\monsterdata_test.mon</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
index 23023bfc..d81a3956 100644
--- a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
@@ -50,8 +50,9 @@ namespace FlatBuffers.Test
}
var inv = fbb.EndVector();
+ var fred = fbb.CreateString("Fred");
Monster.StartMonster(fbb);
- Monster.AddHp(fbb, (short)20);
+ Monster.AddName(fbb, fred);
var mon2 = Monster.EndMonster(fbb);
Monster.StartTest4Vector(fbb, 2);
@@ -83,7 +84,7 @@ namespace FlatBuffers.Test
using (var ms = new MemoryStream(fbb.DataBuffer().Data, fbb.DataBuffer().position(), fbb.Offset()))
{
var data = ms.ToArray();
- File.WriteAllBytes(@"Resources/monsterdata_cstest.bin",data);
+ File.WriteAllBytes(@"Resources/monsterdata_cstest.mon",data);
}
// Now assert the buffer
@@ -113,7 +114,7 @@ namespace FlatBuffers.Test
var monster2 = new Monster();
Assert.IsTrue(monster.Test(monster2) != null);
- Assert.AreEqual(20, monster2.Hp());
+ Assert.AreEqual("Fred", monster2.Name());
Assert.AreEqual(5, monster.InventoryLength());
@@ -130,7 +131,6 @@ namespace FlatBuffers.Test
Assert.AreEqual(100, test0.A() + test0.B() + test1.A() + test1.B());
-
Assert.AreEqual(2, monster.TestarrayofstringLength());
Assert.AreEqual("test1", monster.Testarrayofstring(0));
Assert.AreEqual("test2", monster.Testarrayofstring(1));
@@ -138,7 +138,7 @@ namespace FlatBuffers.Test
public void CanReadCppGeneratedWireFile()
{
- var data = File.ReadAllBytes(@"Resources/monsterdata_test.bin");
+ var data = File.ReadAllBytes(@"Resources/monsterdata_test.mon");
var bb = new ByteBuffer(data);
TestBuffer(bb);
}