コード例 #1
0
        public void When_Updating_Binary_Primitive_Property_On_Client_Then_That_Property_Must_Be_Updated_On_Server()
        {
            using (var scenario =
                       new ODataScenario()
                       .WithSuppliedProducts(Any.Suppliers())
                       .Start())
            {
                var context = GetDataServiceContext(scenario.GetBaseAddress());
                context.MergeOption = MergeOption.OverwriteChanges;
                var dQuery    = context.CreateQuery <Supplier>("/" + "Suppliers");
                var suppliers = context.ExecuteAsync <Supplier, ISupplier>(dQuery).Result;
                suppliers.CurrentPage.Count.Should().Be(5);

                var supplier = suppliers.CurrentPage[2] as Supplier;
                // make sure that the binary primitive property is serialized
                supplier.Blob.Should().NotBeNullOrEmpty();

                // lets update the binary primitive property
                var newBlob = Any.Sequence <byte>(x => Any.Byte()).ToArray();
                supplier.Blob = newBlob;
                supplier.CallOnPropertyChanged("Blob");
                supplier.UpdateAsync().Wait();

                var updatedsuppliers = context.ExecuteAsync <Supplier, ISupplier>(dQuery).Result;
                updatedsuppliers.CurrentPage.Count.Should().Be(5);
                updatedsuppliers.CurrentPage[2].Blob.Should().BeEquivalentTo(newBlob);
            }
        }
コード例 #2
0
        public async void When_digest_has_32_bytes_the_response_has_256_bytes()
        {
            Settings.Precedence = new[] { "test" };

            var keyVaultAgent = new KeyVaultAgent();

            var response = await keyVaultAgent.Sign(Any.Sequence(x => Any.Byte(), 32).ToArray());

            response
            .Should().HaveCount(256, "Because that is the length of an RSA256 signed digest");
        }