public async Task Get_Returns_The_Correct_App_Name() { var testName = "Test App"; _appInfoService.Name.Returns(testName); var result = await _controller.Get(); Assert.AreEqual(result.AppName, testName); }
public void Get_CallsCalculate() { const int number = 5; const string calculatedValue = "Buzz"; Mock <IFizzBuzzService> fizzBuzzService = new Mock <IFizzBuzzService>(MockBehavior.Strict); fizzBuzzService .Setup(x => x.Calculate(number)) .Returns(calculatedValue); using (FizzBuzzController sut = new FizzBuzzController(fizzBuzzService: fizzBuzzService.Object)) { Assert.AreEqual( expected: calculatedValue, actual: sut.Get(number: number) ); } }
private string WhenGetIsCalled() { return(fizzBuzzController.Get(input)); }