public void Create_inputDtoAddActivity_AreNotSame()
        {
            var input = new InputDtoAddActivity("name", 1, 1, 1);
            var unit  = new Unit("type");

            unit.Id = 1;
            var category = new Category("name");

            category.Id = 1;

            var activityFromDto = new Activity(input.Name, input.Repetitions, unit, category);
            var activityInDb    = new Activity(input.Name, input.Repetitions, unit, category);

            activityInDb.Id = 1;

            _activityFactory.CreateFromValues(input.Name, input.Repetitions, unit, category)
            .Returns(activityFromDto);
            _unitRepository.GetById(input.UnitId).Returns(unit);
            _categoryRepository.GetById(input.CategoryId).Returns(category);
            _activityRepository.Create(activityFromDto).Returns(activityInDb);

            OutputDtoAddActivity expected = new OutputDtoAddActivity(1, "other" + input.Name, input.Repetitions, category.Name, unit.Type);

            var res = _activityService.Create(input);

            Assert.AreNotEqual(expected, res);
        }
Exemple #2
0
 protected bool Equals(OutputDtoAddActivity other)
 {
     return(Id == other.Id && Name == other.Name && Repetitions.Equals(other.Repetitions) && CategoryName == other.CategoryName && UnitType == other.UnitType);
 }