public void Test_CreateStation_ReturnsNotFoundResult() { // Arrange var mockRepo = new Mock <IMongoDataRepository <Station> >(); var mockHub = new Mock <IHubContext <LiveStationHub> >(); var controller = new StationsController(mockRepo.Object, mockHub.Object, Mapper); // Act var notFoundResult = controller.CreateStation((StationCreateDto)null); // Assert Assert.IsType <NotFoundResult>(notFoundResult.Result); }
public async void Test_CreateStation_ReturnsOkResult() { // Arrange var mockRepo = new Mock <IMongoDataRepository <Station> >(); var mockHub = new Mock <IHubContext <LiveStationHub> >(); var controller = new StationsController(mockRepo.Object, mockHub.Object, Mapper); this.Mock.GenerateMockStations(); foreach (var position in this.Mock.Positions) { // Act var station = await this.Mock.GetObjectByPositionAsync(position); var okResult = controller.CreateStation(this.Mapper.Map <StationCreateDto>(station)); // Assert Assert.IsType <OkObjectResult>(okResult.Result); } }