Exemplo n.º 1
0
 public async Task <IActionResult> Get(FeatureSetRequest featureSetRequest)
 {
     if (featureSetRequest.KnownVersion == await _featureSetRepository.GetLatestVersion(featureSetRequest.OrgId, featureSetRequest.DeviceVersion))
     {
         return(new HttpStatusCodeResult(304));
     }
     return(Ok(await _featureSetRepository.GetSet(featureSetRequest.OrgId, featureSetRequest.DeviceVersion, featureSetRequest.ClientId)));
 }
Exemplo n.º 2
0
        public async Task FeatureControllerReturns304IfLatestVersion()
        {
            var controller = new FeatureSetController(_featureSetRepository);

            var latestVersion = "blah";

            A.CallTo(() => _featureSetRepository.GetLatestVersion(A <int> .Ignored, A <string> .Ignored)).Returns(latestVersion);

            var result = await controller.Get(new FeatureSetRequest()
            {
                KnownVersion = latestVersion
            });

            var httpStatusCodeResult = result as HttpStatusCodeResult;

            Assert.NotNull(httpStatusCodeResult);
            Assert.AreEqual(304, httpStatusCodeResult.StatusCode);
        }