public void ExtractAndSerializeData_PostsCorrectJson()
        {
            // Assemble
            var sut = Setup();
            JSONParser parser = new JSONParser();

            // Act
            string json = parser.SerializeObject(entity);
            sut.ExtractAndSerializeData();

            //Verify
            httpHandlerMoq.Verify(m => m.PostMasterEntity("", json), "PostMasterEntity was not called");
        }
Beispiel #2
0
        public void JsonParseProductClass()
        {
            //Assemble
            Product product = new Product(1, "Pen", 50);
            JSONParser parser = new JSONParser();

            //Act
            string result = parser.SerializeObject(product);

            //Assert
            string json = "{\"id\":1,\"name\":\"Pen\",\"price\":50}";
            Assert.AreEqual(result, json);
        }
Beispiel #3
0
        public void ExtractAndSerializeData()
        {
            // Initialize MasterEntity to hold data
               MasterEntity dataStorage = dataExtractor.GetData();

               // Serialize to JSON
               JSONParser parser = new JSONParser();
               string json = parser.SerializeObject(dataStorage);

               //System.IO.File.WriteAllText(@"C:\Users\extadmnizi\Desktop\json.txt", json);

               //Post Data
               httpHandler.PostMasterEntity(uri, json);
        }