public ActionResult <ObjectHashResponseModel> Post([FromBody] ObjectHashRequestModel model, [FromQuery] bool generateSalts)
 {
     if (generateSalts)
     {
         GenerateSaltsImplementation.SetRandomSaltsForObjectBaseRequestModel(model);
     }
     return(new ObjectHashResponseModel(new ObjectHash(model)));
 }
        public void Post_WithSalts_WillNotGenerateNewSalts()
        {
            ObjectHashController   controller = new ObjectHashController();
            ObjectHashRequestModel request    = new ObjectHashRequestModel()
            {
                Data = new JObject(new JProperty("sample", "object")), Salts = new JObject(new JProperty("sample", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
            };

            var result = controller.Post(request, false);

            Assert.That(result.Value.Salts, Is.EqualTo(new JObject(new JProperty("sample", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))));
        }
        public void Post_WithoutSalts_WillGenerateNewSalts()
        {
            ObjectHashController   controller = new ObjectHashController();
            ObjectHashRequestModel request    = new ObjectHashRequestModel()
            {
                Data = new JObject(new JProperty("sample", "object")), Salts = null
            };

            var result = controller.Post(request, true);

            Assert.That(result.Value.Salts, Is.Not.Null);
        }