예제 #1
0
        public void Update_Valid()
        {
            //arange
            PlanesService service = new PlanesService(unitOfWork, mapper, validator);

            var expected = new Plane
            {
                Id = 1, DepartureId = 1, PlaneTypeId = 1, Name = "dfg4456", ReleaseDate = new DateTime(1995, 1, 22)
            };

            var DtoToMake = new PlaneDto
            {
                Id = 1, DepartureId = 1, PlaneTypeId = 1, Name = "dfg4456", ReleaseDate = new DateTime(1995, 1, 22)
            };


            //act
            service.Update(DtoToMake);

            var actual = (unitOfWork.Set <Plane>() as FakeRpository <Plane>).updatedItem;

            //assert
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.DepartureId, actual.DepartureId);
            Assert.AreEqual(expected.Name, actual.Name);
            Assert.AreEqual(expected.ReleaseDate, actual.ReleaseDate);
        }
예제 #2
0
        public void Update_UnValid()
        {
            //arange
            PlanesService service = new PlanesService(unitOfWork, mapper, validator);

            var DtoToMake = new PlaneDto
            {
                Id = 1, DepartureId = default(int), Name = "", ReleaseDate = new DateTime(1995, 1, 22)
            };

            //act
            service.Update(DtoToMake);

            var actual = (unitOfWork.Set <Plane>() as FakeRpository <Plane>).updatedItem;

            //assert
            Assert.IsNull(actual);
        }