public void WhenShopByUniqueIdIsNullTheReturnEmptyShop() { var shopRepository = new Mock <IShopRepository>(); shopRepository.Setup(r => r.GetShopById(It.IsAny <Guid>())).Returns((Shop)null); var shopRepositoryService = new ShopRepositoryService(shopRepository.Object, Mock.Of <IUserRepository>()); ShopDto shop = shopRepositoryService.GetShopByUniqueId(It.IsAny <Guid>()); shop.ShouldBeEquivalentTo(ShopDto.EmptyShop); }
public void WhenShopWithSpecifiedUniqueIdExistThenReturnThatShop() { Guid shopGuid = Guid.NewGuid(); var shopRepositoryService = new ShopRepositoryService(Mock.Of <IShopRepository>(r => r.GetShopById(shopGuid) == new Shop() { UniqueId = shopGuid }), Mock.Of <IUserRepository>()); ShopDto shop = shopRepositoryService.GetShopByUniqueId(shopGuid); shop.Should().NotBeNull(); shop.ShopGuid.Should().Be(shopGuid); }