public void GetDogTest() { HotDogService service = new HotDogService(); HotDog dog = service.Get(1); Assert.IsNotNull(dog); Assert.AreEqual("Frank's All Beef Chillidawg", dog.HotDogName); }
public void GetAllDogsTest() { HotDogService service = new HotDogService(); List <HotDog> dogs = service.listAll(); Assert.IsNotNull(dogs); Assert.AreEqual(3, dogs.Count); }
public async Task invoke_create_hotDog() { //arrange var hotDogRepoMock = new Mock <IRepo>(); //TO DO IHotDogService service = new HotDogService(hotDogRepoMock.Object); //act await service.CreateAsync("Adam", 666746666, 2); //assert hotDogRepoMock.Verify(x => x.AddAsync(It.IsAny <HotDog>()), Times.Once()); }
public async Task invoke_get_hotDog() { //arrange HotDog hotDog = new HotDog() { Id = 5, Name = "Piotr", Phone = 2233442 }; var hotDogRepositoryMock = new Mock <IRepo>(); IHotDogService service = new HotDogService(hotDogRepositoryMock.Object); hotDogRepositoryMock.Setup(x => x.GetAsync(hotDog.Id)).ReturnsAsync(hotDog); //act var customerDto = await service.GetAsync(hotDog.Id); //assert hotDogRepositoryMock.Verify(x => x.GetAsync(hotDog.Id), Times.Once()); //TO DO customerDto.Should().NotBeNull(); customerDto.Id.Equals(hotDog.Id); }