Exemple #1
0
        public void RetrieveBinary()
        {
            if (binaryId == null)
            {
                TestResult.Skip();
            }

            var received = client.Read <Binary>(binaryId);

            compareData(DemoData.GetDemoBinary().Content, received);

            var data = DemoData.GetDemoBinary().Content.Reverse().ToArray();

            received.Resource.Content = data;
            client.Update(received);

            received = client.Read <Binary>(binaryId);
            compareData(data, received);
        }
Exemple #2
0
        public void CreateBinary()
        {
            var bin = DemoData.GetDemoBinary();
            ResourceEntry <Binary> received = null;

            HttpTests.AssertSuccess(client, () => received = client.Create <Binary>(bin));

            HttpTests.AssertLocationPresentAndValid(client);

            var binResult = client.Read <Binary>(received.Id);

            if (binResult.Resource.ContentType != bin.ContentType)
            {
                TestResult.Fail("Created binary of type " + bin.ContentType +
                                "but received " + client.LastResponseDetails.ContentType);
            }

            HttpTests.AssertContentLocationValidIfPresent(client);

            compareData(bin.Content, binResult);

            binaryId = received.Id;
        }