public void CriminalProfile_Repository_Create()
        {
            //Arrange
            CriminalProfile c = new CriminalProfile()
            {
                CriminalName = "Test", AddedToSystem = DateTime.Now, NationalityID = 10, Sex = 'm'
            };

            objRepo.Delete(a => a.CriminalName == "Test");
            //Act
            var result = objRepo.Add(c);

            objRepo.Save();

            var lst = objRepo.GetAll().ToList();

            //Assert


            Assert.AreEqual("Test", lst.Last().CriminalName);
        }
示例#2
0
        public void Add_CriminalProfile()
        {
            //Arrange

            CriminalProfile criminalProfile = new CriminalProfile()
            {
                CriminalName = "Test 99", AddedToSystem = DateTime.Now
            };

            _mockRepository.Setup(m => m.Add(criminalProfile)).Returns((CriminalProfile e) =>
            {
                e.CriminalName = "Test 99";
                return(e);
            });


            //Act
            _service.Create(criminalProfile);

            //Assert
            Assert.AreEqual("Test 99", criminalProfile.CriminalName);
            _mockUnitWork.Verify(m => m.Commit(), Times.Once);
        }