Exemplo n.º 1
0
        public void Add_Memory_Ranges()
        {
            // arrange
            var httpBuilder = new HttpFacadeBuilder();

            httpBuilder.WithPostAsync(new HttpResponseMessage(HttpStatusCode.OK));
            httpBuilder.WithPostJsonAsync(new HttpResponseMessage(HttpStatusCode.OK));
            var settings = new Settings
            {
                ServerUrl   = "https://some.server.net",
                ProjectName = "testing"
            };
            var serverClient = new ServerClient {
                HttpFacade = httpBuilder.Build(), Settings = settings
            };

            var headers = new HttpHeaders();

            headers.Add("X-Project-Name", "testing");

            var memoryChunk = new MemoryChunk
            {
                Position    = new Position(0x10, 0x0),
                MemoryRange = new MemoryRange(0x100, 0x200),
                Bytes       = new byte[] { 0x00, 0x11 }
            };

            serverClient.AddMemoryRange(memoryChunk);
            var content = new AddMemoryRequest(memoryChunk);

            httpBuilder.Mock.Verify(
                facade => facade.PostJsonAsync(new Uri("https://some.server.net/api/memory"),
                                               content, headers), Times.Once);
        }