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); }
public async Task SetDone_CheckValidity() { var result = await controller.SetDone(-111); Assert.IsTrue((result as NotFoundResult) != null, "It should return NotFound with invalid AlterationId"); }