public void CalculateCaloriesPerGram_WhenCalled_ShouldReturnProperValue() { _systemUnderTest = FakeIngredientFactory.CreateIngredientWithOneShare( IngredientName, MacroNutrient.Carbohydrate, _ingredientRepositoryMock.Object); var result = _systemUnderTest.CalculateCalories(100); result.Should().Be(80); }
public void SetUp() { _eventPublisherMock = new Mock<IEventPublisher>(); _ingredientRepositoryMock = new Mock<IIngredientRepository>(); _ingredientRepositoryMock.Setup(x => x.ExistByName(It.IsAny<string>())) .Returns(false); _systemUnderTest = FakeIngredientFactory.CreateValidIngredientWithEventPublisher(IngredientName, _ingredientRepositoryMock.Object, _eventPublisherMock.Object); }
public void SetUp() { var ingredient = FakeIngredientFactory.CreateValidIngredient("Ingredient", _ingredientRepositoryMock.Object); _ingredientRepositoryMock.Setup(x => x.ExistByName(It.IsAny <string>())) .Returns(true); _ingredientRepositoryMock.Setup(x => x.GetById(It.IsAny <Guid>())) .Returns(ingredient); }
public void SetUp() { _command = CommandFactory.EmptyUpdateIngredientCommand(); _eventPublisherMock = new Mock <IEventPublisher>(); _validator.Setup(x => x.Validate(It.IsAny <UpdateIngredientCommand>())) .Returns(Result.Ok); _validators = new List <ICommandValidator <UpdateIngredientCommand> > { _validator.Object }; _ingredient = FakeIngredientFactory.CreateValidIngredient("Ingredient", _ingredientRepositoryMock.Object); _systemUnderTests = new UpdateIngredientCommandHandler(_ingredientRepositoryMock.Object, _validators, _eventPublisherMock.Object); }
public void SetUp() { _ingredientRepositoryMock = new Mock <IIngredientRepository>(); _eventPublisherMock = new Mock <IEventPublisher>(); _ingredientRepositoryMock.Setup(x => x.ExistByName(It.IsAny <string>())) .Returns(false); _recipeRepositoryMock = new Mock <IRecipeRepository>(); _command = new DeleteIngredientCommand(Guid.NewGuid()); _ingredient = FakeIngredientFactory.CreateValidIngredient( Guid.NewGuid(), "Ingredient", 0.2, 0.3, 0.4, _ingredientRepositoryMock.Object); _systemUnderTest = new DeleteIngredientCommandHandler(_ingredientRepositoryMock.Object, _eventPublisherMock.Object); }
public void SetUp() { _ingredient = FakeIngredientFactory.CreateValidIngredient("IngredientName", _ingredientRepositoryMock.Object); _query = new GetIngredientQuery(Guid.NewGuid()); _systemUnderTests = new GetIngredientQueryHandler(_ingredientRepositoryMock.Object); }
public void GivenEmptyName_DuringIngredientCreating_ShouldThrowArgumentNullException() { Action action = () => FakeIngredientFactory.CreateValidIngredient(null, _ingredientRepositoryMock.Object); action.Should().Throw<ArgumentNullException>(); }
public void SetUp() { _ingredientRepositoryMock.Setup(x => x.GetByIds(It.IsAny <ICollection <Guid> >())) .Returns(FakeIngredientFactory.CreateIngredientsCollection(_ids, _ingredientRepositoryMock.Object)); _systemUnderTests = new GetAggregatedIngredientsDetailsQueryHandler(_ingredientRepositoryMock.Object); }