public void ContractController_Get_ShouldBeCorrectInt()
        {
            var result = _controller.Get(1);

            Assert.AreEqual(1, _mockService.CallCount);
            Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <ContractDetail>));
        }
Beispiel #2
0
        public async Task GetById()
        {
            // Arrange
            ContractController controller = new ContractController();

            // Act
            var result = await controller.Get("5");

            // Assert
            Assert.IsNotNull(result);
            //Assert.AreEqual("value", result);
        }
Beispiel #3
0
        public void GetContract()
        {
            var mock = new Mock <IRepository <Contract> >();

            mock.Setup(repo => repo.GetById(It.IsAny <int>())).Returns(GetByIdTest(1));
            var factoryMock = new Mock <IRepositoryFactory>();

            factoryMock.Setup(f => f.GetRepository <Contract>()).Returns(mock.Object);
            _contractController = new ContractController(factoryMock.Object);

            var json     = _contractController.Get(1);
            var contract = json.Value as Contract;

            Assert.NotNull(json);
            Assert.NotNull(contract);
            Assert.AreEqual(contract.Id, 1);
        }