Beispiel #1
0
        public byte[] GetFileDescriptorSet()
        {
            var descriptor = Descriptors.Last();
            var output     = new FileDescriptorSet();

            output.File.AddRange(GetSelfAndDependency(descriptor.File).Select(x => x.SerializedData));
            return(output.ToByteArray());
        }
        public void GetFileDescriptors_Test()
        {
            var executive       = CreateExecutive();
            var fileDescriptors = executive.GetFileDescriptors();

            var descriptors = fileDescriptors.ToList();

            descriptors.Count.ShouldBe(5);
            descriptors.ShouldContain(f => f.Name == "google/protobuf/descriptor.proto");
            descriptors.ShouldContain(f => f.Name == "google/protobuf/empty.proto");
            descriptors.ShouldContain(f => f.Name == "google/protobuf/timestamp.proto");
            descriptors.ShouldContain(f => f.Name == "aelf/options.proto");
            descriptors.ShouldContain(f => f.Name == "test_contract.proto");

            var set = new FileDescriptorSet();

            set.File.AddRange(descriptors.Select(x => x.SerializedData));

            var fileDescriptorSet = executive.GetFileDescriptorSet();

            fileDescriptorSet.ShouldBe(set.ToByteArray());
        }