public void Test_CorridorServices_Delete_Corridor() { try { /* Creating new Corridor */ CorridorServices cs = new CorridorServices(); string NewCorridorName = "T1234"; cs.Post(NewCorridorName); /* Get the new Corridor's ID */ List <CorridorModel> CorridorList = new List <CorridorModel>(); CorridorModel NewCorridor = new CorridorModel(); CorridorList = cs.List(); NewCorridor = CorridorList.Find(x => x.corridorName == NewCorridorName); /* Try to delete the new Corridor */ cs.Delete(NewCorridor.corridorId); } catch (Exception e) { Assert.Fail("Expected no exception, but got " + e.Message); } }
public void Test_CorridorServices_Delete_User_From_Corridor() { try { /* Creating new Corridor */ CorridorServices cs = new CorridorServices(); string NewCorridorName = "T1234"; cs.Post(NewCorridorName); /* Get the created CorridorModel from the database */ List <CorridorModel> CorridorList = new List <CorridorModel>(); CorridorModel Corridor = new CorridorModel(); CorridorList = cs.List(); Corridor = CorridorList.Find(x => x.corridorName == NewCorridorName); /* Creates the new User */ UserServices us = new UserServices(); UserModel NewUser = new UserModel() { UserName = "******", firstname = "Johan", lastname = "Johansson" }; us.Post(NewUser); /* Adds a User to the Corridor */ cs.Post(Corridor.corridorId, NewUser.UserName); /* Delete User from Corridor */ cs.Delete(Corridor.corridorId, NewUser.UserName); } catch (Exception e) { Assert.Fail("Expected no exception, but got " + e.Message); } }