public void TypesControllerUpdateTest() { var topic = CreateContext(); var typeId = Guid.NewGuid(); var Logic = CreateLogic(); var Controller = new TypesController(Logic); TypeEntity type = new TypeEntity() { Id = typeId, Name = "First Type", Topic = topic, TopicId = topic.Id }; Logic.Create(type); type.Name = "Updated Type"; var result = Controller.Put(typeId, TypeDTO.ToModel(type)); var createdResult = result as CreatedAtRouteResult; var model = createdResult.Value as TypeDTO; Assert.AreEqual("Updated Type", model.Name); }
public void Put_Valid_API() { //Arrange Type item = new Type() { ID = id, Description = "test", Status = "test" }; //Act var actionResult = controllerAPI.Put(id, item); var contentResult = actionResult as OkNegotiatedContentResult <Type>; //Assert Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.IsInstanceOfType(contentResult.Content, typeof(Type)); }