Exemplo n.º 1
0
        public async Task SendLetterNotificationGeneratesExpectedRequest()
        {
            Dictionary <string, dynamic> personalisation = new Dictionary <string, dynamic>
            {
                { "address_line_1", "Foo" },
                { "address_line_2", "Bar" },
                { "postcode", "Baz" }
            };
            JObject expected = new JObject
            {
                { "template_id", Constants.fakeTemplateId },
                { "personalisation", JObject.FromObject(personalisation) },
                { "reference", Constants.fakeNotificationReference }
            };

            MockRequest(Constants.fakeTemplatePreviewResponseJson,
                        client.SEND_LETTER_NOTIFICATION_URL,
                        AssertValidRequest,
                        HttpMethod.Post,
                        AssertGetExpectedContent, expected.ToString(Formatting.None));

            LetterNotificationResponse response = await client.SendLetterAsync(Constants.fakeTemplateId, personalisation, Constants.fakeNotificationReference);
        }