public void GetSeatsTest() { // Act var result = _seatsController.GetSeats(4); // Assert var content = Assert.IsAssignableFrom <IEnumerable <SeatDto> >(result.Value); Assert.Equal(100, content.Count()); }
public void GetSeats_ReturnJsonString() { var seats = new List <Seat>(); seats.Add(new Seat(new SeatDefinition("usb#vid_046d&pid_0826&mi_02#6&24bf100&0&0002", "杉田 圭輔"), SeatState.Exists)); seats.Add(new Seat(new SeatDefinition("usb#vid_046d&pid_0826&mi_02#6&24bf100&0&0003", "Keisuke Sugita"), SeatState.NotExists)); seats.Add(new Seat(new SeatDefinition("usb#vid_046d&pid_0826&mi_02#6&24bf100&0&0004", "スギタ ケイスケ"), SeatState.Failure)); var seatsScannerMock = new Mock <ISeatsScanner>(); seatsScannerMock.Setup(x => x.ScanAll()).Returns(seats); var seatsController = new SeatsController(seatsScannerMock.Object); var seatsResults = seatsController.GetSeats().Content.ReadAsStringAsync().Result; Assert.AreEqual(@"[{""name"":""杉田 圭輔"",""status"":""Exists""},{""name"":""Keisuke Sugita"",""status"":""NotExists""},{""name"":""スギタ ケイスケ"",""status"":""Failure""}]", seatsResults); }