public void CalculationGet() { // Arrange var results = new List <CalculationResult> { { new CalculationResult { OperationName = "Add", Result = "1", num1 = 0, num2 = 1 } }, { new CalculationResult { OperationName = "Multiply", Result = "2", num1 = 1, num2 = 2 } }, { new CalculationResult { OperationName = "Compare", Result = "0", num1 = 1, num2 = 1 } } }; var mock = new Mock <IRepository>(); mock.SetupGet(m => m.Results).Returns(results); var controller = new CalculationController(mock.Object); // Act var model = controller.Get(); // Assert Assert.Equal(results, model); }
public void Can_Get_Stored_TaxCalculations() { A.CallTo(() => _taxCalculationQueryProvider.Query).WithAnyArguments().Returns(CalculationTestData.TaxCalculations); _calculationController = new CalculationController(_taxCalculationQueryProvider, _calculationComm); var results = _calculationController.Get(); Assert.IsTrue(results.Value.Count() > 0);//There is or are postal codes... foreach (var calculation in results.Value) { Assert.IsTrue(calculation.Income > 0); //there should always be a positive number as an income Assert.IsTrue(calculation.Id > 0); //the id should always be available on each record for a Delete or Updates? Assert.IsTrue(calculation.PostalCode != ""); //There should alwasy be a postal code, no empty string is expected by the Client } }