Ameausoone / demo-github-action

12 stars 1 forks source link

How to test #68

Open bessaleh opened 2 years ago

bessaleh commented 2 years ago

How to test

github-actions[bot] commented 2 years ago

[TestFixture] public class Test { [Test] public void CreateCarServiceTest() { var carQueryMock = new Mock(); var carRepositoryMock = new Mock(); var createCarService = new CreateCarService(carQueryMock.Object, carRepositoryMock.Object);

    carQueryMock.Setup(c => c.IsLoginExist(It.IsAny<string>())).Returns(false);
    carQueryMock.Setup(c => c.IsEmailExist(It.IsAny<string>())).Returns(false);

    createCarService.Create(new Car());
    carRepositoryMock.Verify(c => c.Add(It.IsAny<Car>()), Times.Once);
}

}