Ejemplo n.º 1
0
        public void AddNewOffice_ThrowsException_WhenCityIsEmpty()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = 78,
                    StreetName   = "rue Saint André",
                    City         = "",
                    ZipCode      = 59800
                };

                oc.CreateOffice(office);
            }
        }
Ejemplo n.º 2
0
        public void AddNewOffice_ThrowsException_WhenStreetNameIsNull()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = 78,
                    StreetName   = null,
                    City         = "Lille",
                    ZipCode      = 59800
                };

                oc.CreateOffice(office);
            }
        }
Ejemplo n.º 3
0
        public void AddNewOffice_ThrowsException_WhenStreetNumberIsEmpty()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = Convert.ToInt32(null),
                    StreetName   = "rue Saint André",
                    City         = "Lille",
                    ZipCode      = 59800
                };

                oc.CreateOffice(office);
            }
        }
Ejemplo n.º 4
0
        public void AddNewOffice_ThrowsException_WhenZipCodeIsEmpty()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = 74,
                    StreetName   = "rue Saint André",
                    City         = "Lille"
                                   //zip_code = ,
                };

                oc.CreateOffice(office);
            }
        }
Ejemplo n.º 5
0
        public void AddNewOffice_OfficeIsStoredInDataStore()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = 74,
                    StreetName   = "rue Saint André",
                    City         = "Lille",
                    ZipCode      = 59800
                };


                oc.CreateOffice(office);

                var exists = oc.DataContext.Offices.Any(c => c.Id == office.Id);

                Assert.IsTrue(exists);
            }
        }
Ejemplo n.º 6
0
        public void UpdateOffice_AppliedValuesAreStoredInDataStore()
        {
            using (var oc = new OfficeContext())
            {
                var office = new Office
                {
                    StreetNumber = 74,
                    StreetName   = "rue Saint André",
                    City         = "Lille",
                    ZipCode      = 59800
                };

                oc.CreateOffice(office);

                const int newStreetNumber  = 12,
                          newZipCode       = 59700;
                const string newStreetName = "avenue de la République",
                             newCity       = "Marcq-en-Baroeul";

                office.StreetNumber = newStreetNumber;
                office.StreetName   = newStreetName;
                office.City         = newCity;
                office.ZipCode      = newZipCode;

                // Act
                oc.UpdateOffice(office);

                // Assert
                oc.DataContext.Entry(office).Reload();

                Assert.AreEqual(newStreetNumber, office.StreetNumber);
                Assert.AreEqual(newZipCode, office.ZipCode);
                Assert.AreEqual(newStreetName, office.StreetName);
                Assert.AreEqual(newCity, office.City);
            }
        }