// ReSharper disable once InconsistentNaming public async void Can_PUT_Update_an_Asset_Classification_By_Asset_Class() { // Arrange _ctrl = new AssetClassController(_repository) { Request = new HttpRequestMessage { RequestUri = new Uri(UrlBase + "/AssetClass/TEST") }, Configuration = new HttpConfiguration() }; var editedClassification = new AssetClass { KeyId = new Guid("3437791f-3e3f-4f76-a266-a47600c39453"), LastUpdate = "TEST", Description = DateTime.Now.ToString("g") }; // Act //var debugJsonForFiddler = TestHelpers.ObjectToJson(editedClassification); var assetClassResult = await _ctrl.UpdateAssetClass(editedClassification, editedClassification.LastUpdate.Trim()) as OkNegotiatedContentResult<AssetClass>; // Assert Assert.IsNotNull(assetClassResult); }
// ReSharper disable once InconsistentNaming public async void Can_POST_a_New_Asset_Classification() { // Arrange _ctrl = new AssetClassController(_repository) { Request = new HttpRequestMessage { RequestUri = new Uri(UrlBase + "/AssetClass") }, Configuration = new HttpConfiguration() }; var newClassification = new AssetClass { LastUpdate = "TEST", Description = DateTime.Now.ToString("g") }; // Act var debugJsonForFiddler = TestHelpers.ObjectToJson(newClassification); var response = await _ctrl.CreateNewAssetClass(newClassification) as CreatedNegotiatedContentResult<AssetClass>; // Assert Assert.IsNotNull(response); Assert.That(response.Location.AbsoluteUri.Contains("api/AssetClass/TEST"), Is.True); }