Пример #1
0
        public void ParcelService_GetParcel_Verify()
        {
            //arrange
            var parcelSvc = new ParcelService();

            //act
            var parcel = parcelSvc.GetParcel(1);

            //assert
            Assert.True(1 == parcel.Id, "Ids don't match");
        }
Пример #2
0
        public void ParcelSvc_GetParcel_ValidateData()
        {
            //arrange
            int id     = 4;
            var parcel = new Parcel
            {
                Id       = id,
                Name     = "AJ's House",
                Township = "Las Vegas",
                Owner    = "Clark County"
            };

            Mock <IParcelDataAccess> daMock = new Mock <IParcelDataAccess>();

            daMock.Setup(dataAccess => dataAccess.GetParcel(It.IsAny <int>())).Returns(parcel);

            var parcelSvc = new ParcelService(daMock.Object);

            //act
            var result = parcelSvc.GetParcel(id);

            //assert
            Assert.IsTrue(result.Id == id, "failed to return expected value");
        }