public async Task can_create_assign_get_assignes_() { //Create Roomie var roomie = await TestStubs.StubRoomie(); int roomieId = roomie.Content; ///Create Coloc var coloc = await TestStubs.StubColoc(roomieId); int colocId = coloc.Content; //Create task string taskName = TestHelpers.RandomTestName(); string des = TestHelpers.RandomTestName() + "Description"; DateTime date = TestHelpers.RandomDate(2); var task = await Gateway.Create(taskName, des, date, colocId); int taskId = task.Content; await Gateway.Assign(taskId, roomieId); IEnumerable <TaskRoomies> assignees = await Gateway.GetAssignedRoomies(3); }
public async Task can_assign_task() { string taskName = TestHelpers.RandomTestName(); string des = TestHelpers.RandomTestName() + "Description"; DateTime date = TestHelpers.RandomDate(2); //Create roomie Result <int> roomieResult = await TestStubs.StubRoomie(); int roomieId = roomieResult.Content; //create coloc Result <int> colocResult = await TestStubs.StubColoc(roomieId); int colocId = colocResult.Content; var taskResult = await Gateway.Create(taskName, des, date, colocId); Assert.That(taskResult.Status, Is.EqualTo(Status.Created)); int taskId = taskResult.Content; { Result r = await Gateway.Assign(taskId, roomieId); Assert.That(r.Status, Is.EqualTo(Status.Ok)); } { Result r = await Gateway.Assign(taskId, roomieId); Assert.That(r.Status, Is.EqualTo(Status.BadRequest)); } ///create an other roomie to update roomieResult = await TestStubs.StubRoomie(); roomieId = roomieResult.Content; { Result r = await Gateway.Assign(taskId, roomieId); Assert.That(r.Status, Is.EqualTo(Status.Ok)); } { Result r = await Gateway.Unassign(taskId, roomieId); Assert.That(r.Status, Is.EqualTo(Status.Ok)); } { Result r = await Gateway.Unassign(taskId, roomieId); Assert.That(r.Status, Is.EqualTo(Status.BadRequest)); } }
public async Task can_create_update_and_delete_a_coloc() { string name = TestHelpers.RandomTestName(); ///create a roomie var roomieResult = await TestStubs.StubRoomie(); int roomieId = roomieResult.Content; var result = await Sut.Create(roomieId, name); Assert.That(result.Status, Is.EqualTo(Status.Created)); int colocId = result.Content; Result <ColocData> colocData; { colocData = await Sut.FindById(colocId); CheckColoc(colocData, name); } { name = TestHelpers.RandomTestName(); string picPath = "an other awesome picture ;)"; Result r = await Sut.Update(colocId, name, picPath); Assert.That(r.Status, Is.EqualTo(Status.Ok)); colocData = await Sut.FindById(colocId); CheckColoc(colocData, name, picPath); } // Work on coloc deletion //can delete a coloc only if there is one roomie left and has to delete all info such as Tasks, events, etc //{ // Result c = await Sut.Delete(colocId); // Assert.That(c.Status, Is.EqualTo(Status.Ok)); // colocData = await Sut.FindById(colocId); // Assert.That(c.Status, Is.EqualTo(Status.NotFound)); //} }