コード例 #1
0
 public void TestCreateModelIsNewLocation()
 {
     var result = _controller.Create() as ViewResult;
     var model = result.ViewData.Model as Location;
     var expected = new Location();
     Assert.IsTrue(LocationsAreEquivalent(expected, model), "Model should be a new Location");
 }
コード例 #2
0
 public void DeleteLocation(Location location)
 {
     _locations.Remove(location);
 }
コード例 #3
0
 public void AddLocation(Location location)
 {
     location.id = ++_locationMaxId;
     _locations.Add(location);
 }
コード例 #4
0
 public void AddLocation(Location location)
 {
     _conferenceware.Locations.InsertOnSubmit(location);
 }
コード例 #5
0
 public void DeleteLocation(Location location)
 {
     _conferenceware.Locations.DeleteOnSubmit(location);
 }
コード例 #6
0
 partial void DeleteLocation(Location instance);
コード例 #7
0
 partial void UpdateLocation(Location instance);
コード例 #8
0
 partial void InsertLocation(Location instance);
コード例 #9
0
        private void InitRepoAndTwoLocations()
        {
            _location1 = new Location
                            {
                                building_name = "Siebel Center",
                                room_number = "1404",
                                max_capacity = 175,
                                notes = "Large lecture hall in Siebel"
                            };
            _location2 = new Location
                            {
                                building_name = "Digital Computer Laboratory",
                                room_number = "1320",
                                max_capacity = 200,
                                notes = "Power avaiable to people in the room"
                            };
            _location3 = new Location
                            {
                                building_name = "Building",
                                room_number = "Room",
                                max_capacity = 10,
                                notes = "Notes"
                            };

            _repository = new TestRepository();
            _repository.AddLocation(_location1);
            _repository.AddLocation(_location2);
            _repository.Save();
        }
コード例 #10
0
 private FormCollection ConvertLocationToFormCollection(Location loc)
 {
     var fc = new FormCollection();
     fc.Add("id", loc.id.ToString());
     fc.Add("building_name", loc.building_name);
     fc.Add("room_number", loc.room_number);
     fc.Add("max_capacity", loc.max_capacity.ToString());
     fc.Add("notes", loc.notes);
     return fc;
 }
コード例 #11
0
 /// <summary>
 /// Checks if two locations are equivalent for data (less id)
 /// </summary>
 /// <param name="loc1">The first location to check</param>
 /// <param name="loc2">The second location to check</param>
 /// <returns>Whether or not the locations are equivalent</returns>
 private static bool LocationsAreEquivalent(Location loc1, Location loc2)
 {
     return loc1.building_name == loc2.building_name
            && loc1.room_number == loc2.room_number
            && loc1.max_capacity == loc2.max_capacity
            && loc1.notes == loc2.notes;
 }