Exemplo n.º 1
0
        public void ConstantsArchiveContactRequestFormedCorrectly()
        {
            var    mockDataSource = MockRepository.GenerateMock <IWebClient>();
            string expectedUrl    = Constants.ArchiveContactUrl;

            // Arrange
            mockDataSource
            .Stub(x => x.UploadString(
                      Arg <string> .Is.Anything, // uri
                      Arg <string> .Is.Anything, // method
                      Arg <string> .Is.Anything, // content-type
                      Arg <string> .Is.Anything  // data
                      )).Return(string.Empty);

            // Act
            var target = new Contacts(apiKey: Constants.ApiKey)
            {
                UserWebClient = mockDataSource
            };

            target.ArchiveContact(contactId: "61571");

            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                                               uri: Arg <string> .Matches(actaulUrl => actaulUrl == expectedUrl),
                                               method: Arg <string> .Matches(actaulMethod => actaulMethod == "DELETE"),
                                               contentType: Arg <string> .Matches(actualContentType => actualContentType == "application/text"),
                                               data: Arg <string> .Is.Anything));
        }