Esempio n. 1
0
        public void Dinner_Should_Be_Valid_When_All_Properties_Correct()
        {
            Location location = new Location
            {
                Latitude = 93,
                Longitude = -92
            };
            //Arrange
            Dinner dinner = new Dinner {
                Title = "Test title",
                Description = "Some description",
                EventDate = DateTime.Now,
                HostedBy = "ScottGu",
                Address = "One Microsoft Way",
                Country = "USA",
                ContactPhone = "425-703-8072",
                Location = location
            };

            // Act
            bool isValid = dinner.IsValid;

            //Assert
            Assert.IsTrue(isValid);
        }
Esempio n. 2
0
        public static List<Dinner> CreateTestDinners()
        {
            List<Dinner> dinners = new List<Dinner>();

            for (int i = 0; i < 101; i++)
            {
                Location loc = new Location(-99, 99);

                Dinner sampleDinner = new Dinner()
                {
                    DinnerID = Oid.NewOid(),
                    Title = "Sample Dinner",
                    HostedBy = "SomeUser",
                    Address = "Some Address",
                    Country = "USA",
                    ContactPhone = "425-555-1212",
                    Description = "Some description",
                    EventDate = DateTime.Now.AddDays(i),
                    Location = loc
                };

                RSVP rsvp = new RSVP();
                rsvp.AttendeeName = "SomeUser";
                sampleDinner.RSVPs.Add(rsvp);

                dinners.Add(sampleDinner);
            }

            return dinners;
        }
Esempio n. 3
0
 public static Dinner CreateDinner()
 {
     Dinner dinner = new Dinner();
     dinner.Title = "New Test Dinner";
     dinner.EventDate = DateTime.Now.AddDays(7);
     dinner.Address = "5 Main Street";
     dinner.Description = "Desc";
     dinner.ContactPhone = "503-555-1212";
     dinner.HostedBy = "scottgu";
     dinner.Location.Latitude = 45;
     dinner.Location.Longitude = 45;
     dinner.Country = "USA";
     return dinner;
 }
Esempio n. 4
0
        public void CreateAction_Should_Fail_Give_Empty_Dinner()
        {
            // Arrange
            var controller = CreateDinnersControllerAs("scottgu");
            Dinner dinner = new Dinner();

            // Act
            ViewResult result = (ViewResult)controller.Create(dinner);

            // Assert
            //Assert.IsInstanceOfType(result, typeof(ViewResult));
            Assert.IsTrue(result.ViewData.ModelState.IsValid == false);
            Assert.AreEqual(6, result.ViewData.ModelState.Sum(p => p.Value.Errors.Count), "Expected Errors");
        }
Esempio n. 5
0
        public void Dinner_Should_Not_Be_Valid_When_Some_Properties_Incorrect()
        {
            //Arrange
            Dinner dinner = new Dinner() {
                Title = "Test title",
                Country = "USA",
                ContactPhone = "BOGUS"
            };

            // Act
            bool isValid = dinner.IsValid;

            //Assert
            Assert.IsFalse(isValid);
        }
 partial void DeleteDinner(Dinner instance);
 partial void UpdateDinner(Dinner instance);
 partial void InsertDinner(Dinner instance);
Esempio n. 9
0
 public void Delete(Dinner dinner)
 {
     //db.RSVPs.DeleteAllOnSubmit(dinner.RSVPs);
     //db.Dinners.DeleteOnSubmit(dinner);
     dinners.Delete(dinner);
 }
Esempio n. 10
0
 //
 // Insert/Delete Methods
 public void Add(Dinner dinner)
 {
     //db.Dinners.InsertOnSubmit(dinner);
     dinners.Insert(dinner);
 }
Esempio n. 11
0
 public void Delete(Dinner dinner)
 {
     //db.RSVPs.DeleteAllOnSubmit(dinner.RSVPs);
     //db.Dinners.DeleteOnSubmit(dinner);
     dinners.Delete(dinner);
 }
Esempio n. 12
0
        //
        // Insert/Delete Methods

        public void Add(Dinner dinner)
        {
            //db.Dinners.InsertOnSubmit(dinner);
            dinners.Insert(dinner);
        }
Esempio n. 13
0
 public void Delete(Dinner dinner)
 {
     dinnerList.Remove(dinner);
 }
Esempio n. 14
0
 public void Add(Dinner dinner)
 {
     dinnerList.Add(dinner);
 }