public async System.Threading.Tasks.Task GetTimeRegistration_When_Called_With_IdAndGuid_Returns_TimeRegistration()
        {
            // Arrange
            await sut.CreateTimeRegistration(timeRegistration, timeRegistration.TenantId);

            var expectedResult = JsonConvert.SerializeObject(timeRegistration);
            // Act
            var call = await sut.GetTimeRegistration(timeRegistration.Id, timeRegistration.TenantId);

            var actualResult = JsonConvert.SerializeObject(call);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }
Ejemplo n.º 2
0
        public IHttpActionResult CreateTimeRegistration(string employeeId, CreateTimeRegistrationModel model)
        {
            if (string.IsNullOrEmpty(employeeId))
            {
                ModelState.AddModelError("", "Invalid employee ID.");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            employeeId = employeeId.ToUpperInvariant();
            var registration = _repository.CreateTimeRegistration(model.TaskId, employeeId, model.Start, model.End, model.Remarks);

            return(CreatedAtRoute("GetRegistrationRoute", new { employeeId, registration.Id }, registration));
        }