Example #1
0
        public void WhenImportWithCorrectContractThenWorks()
        {
            var generator = new ProtobufContractGenerator(_tempXmlFileCorrect);
            var model     = generator.GenerateContractCode("TestUtilities.dll");

            var testClassA = new TestClassA {
                AString1 = "ABC", AString2 = "XYZ", AInt = 3
            };

            string filename = _tempProtoFile;

            var readTestClassA = Read <TestClassA>(filename, model);

            Assert.AreEqual(testClassA.AString1, readTestClassA.AString1);
            Assert.AreEqual(testClassA.AString2, readTestClassA.AString2);
        }
Example #2
0
        public void WhenExportAndImportTestClassesThenWorks()
        {
            var generator = new ProtobufContractGenerator(_tempXmlFileCorrect);
            var model     = generator.GenerateContractCode("TestUtilities.dll");

            var filename = Path.Combine(_tempDirectory, "test.proto");

            var testClassA = new TestClassA {
                AString1 = "ABC", AString2 = "XYZ"
            };

            Write(filename, testClassA, model);

            var readTestClassA = Read <TestClassA>(filename, model);

            Assert.AreEqual(testClassA.AString1, readTestClassA.AString1);
            Assert.AreEqual(testClassA.AString2, readTestClassA.AString2);
        }