Пример #1
0
        public void Add_Tags()
        {
            // 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");

            // act
            serverClient.AddTag(new Position(0xabc, 0x123), new[] { 1 }, new Tag());

            // assert
            httpBuilder.Mock.Verify(
                facade => facade.PostJsonAsync(new Uri("https://some.server.net/api/tag"),
                                               new AddTagRequest(new Position(0xabc, 0x123), new[] { 1 }, new Tag()), headers), Times.Once);
        }