Ejemplo n.º 1
0
        public void EqualsShouldReturnTrue()
        {
            DriverInCar driverInCar1 = new DriverInCar()
            {
                Address = "Peremogy, 50", CarId = 1, DriverId = 1, Location = "50.456487, 30.444342"
            };
            DriverInCar driverInCar2 = new DriverInCar()
            {
                Address = "Peremogy, 50", CarId = 1, DriverId = 1, Location = "50.456487, 30.444342"
            };

            Assert.True(driverInCar1.Equals(driverInCar2));
            Assert.True(driverInCar2.Equals(driverInCar1));
            Assert.True(driverInCar1.Equals(driverInCar1));
            Assert.True(driverInCar2.Equals(driverInCar2));
        }
Ejemplo n.º 2
0
        public void EqualsShouldReturnFalse()
        {
            DriverInCar driverInCar1 = new DriverInCar()
            {
                Address = "Peremogy, 50", CarId = 1, DriverId = 1, Location = "50.456487, 30.444342"
            };
            DriverInCar driverInCar2 = new DriverInCar()
            {
                Address = "Peremogy, 51", CarId = 1, DriverId = 1, Location = "50.456487, 30.444342"
            };
            DriverInCar driverInCar3 = new DriverInCar()
            {
                Address = "Peremogy, 50", CarId = 2, DriverId = 1, Location = "50.456487, 30.444342"
            };
            DriverInCar driverInCar4 = new DriverInCar()
            {
                Address = "Peremogy, 50", CarId = 1, DriverId = 2, Location = "50.456488, 30.444342"
            };

            Assert.False(driverInCar1.Equals(driverInCar2));
            Assert.False(driverInCar1.Equals(driverInCar3));
            Assert.False(driverInCar1.Equals(driverInCar4));
        }
        public void GetDriverInCarShouldReturnDriverInCar()
        {
            MockRepository      repo = new MockRepository();
            ITaxiDataRepository sut  = repo.StrictMock <Linq2SqlTaxiDataRepository>();

            int         id  = 1;
            DriverInCar dIC = new DriverInCar(id);

            dIC.CarId    = 3;
            dIC.DriverId = 3;
            dIC.Address  = "Akademika Glushkova 12A";
            dIC.Location = "50.374211, 30.462582";


            Expect.Call(sut.GetDriverInCar(id)).Return(dIC);
            repo.ReplayAll();
            Assert.True(dIC.Equals(sut.GetDriverInCar(id)));
            repo.VerifyAll();
        }