public async Task CreateAlteration_Should_Raise_BadRequest_InvalidCustomerId() { var result = await controller.CreateAlteration(new EntityFramework.Alterings.Altering { CustomerId = -1234 }); Assert.IsTrue((result as BadRequestObjectResult) != null, "It should return BadRequest with invalid CustomerId"); }
public async Task SetDone_CheckFunctionality() { var mock = new Mock <IBus>(); var data = new EntityFramework.Alterings.Altering { CustomerId = 1, Value = 1 }; mock.Setup(x => x.Publish(new AlterationFinished(), default)).Returns(Task.CompletedTask); controller = new AlteringsController(new AzureBasedMicroserviceContext(), mock.Object); await controller.CreateAlteration(data); var result = await controller.SetDone(data.Id); Assert.IsTrue(data.State == EntityFramework.Alterings.AlteringState.Done); Assert.IsTrue((result as OkResult) != null, "It should return OkResult with valid AlterationId"); removeAlterationFromDb(data.Id); }