コード例 #1
0
        public void ContactRepository_GetAllPaged_CountCorrect()
        {
            const int expectedCount = 2;

            var dbSetMock = SetUpData();
            var classUnderTest = new TestContactRepository(dbSetMock);

            var data = classUnderTest.GetAllPaged(1, 2);

            Assert.Equal(expectedCount, data.Count());
        }
コード例 #2
0
        public void ContactRepository_Get_NotNull()
        {
            //Arrange
            const int expectedId = 1;

            var dbSetMock = SetUpData();
            var classUnderTest = new TestContactRepository(dbSetMock);

            //Action
            var actual = classUnderTest.Get(expectedId);

            //Assert
            Assert.NotNull(actual);
        }
コード例 #3
0
        public void ContactRepository_GetAll_CountCorrect()
        {
            //Arrange
            const int expectedCount = 4;

            var dbSetMock = SetUpData();
            var classUnderTest = new TestContactRepository(dbSetMock);

            //Action
            var data = classUnderTest.GetAll();

            //Assert
            Assert.Equal(expectedCount, data.Count());
        }
コード例 #4
0
        public void ContactController_Get_IdIsCorrect()
        {
            //Arrange
            const int expectedId = 1;
            var mockData = SetUpData();
            var repo = new TestContactRepository(mockData);
            var testClass = new Web.Controllers.ContactController(repo);

            //Act
            var contact = testClass.Get(expectedId);

            //Assert
            Assert.Equal(expectedId, contact.ContactID);
        }
コード例 #5
0
        public void ContactController_Count_CountIsCorrect()
        {
            //Arrange
            const int expectedCount = 4;
            var mockData = SetUpData();
            var repo = new TestContactRepository(mockData);
            var testClass = new Web.Controllers.ContactController(repo);

            //Act
            var count = testClass.Count();

            //Assert
            Assert.Equal(expectedCount, count);
        }
コード例 #6
0
        public void ContactController_GetAllPaged_CountIsCorrect()
        {
            //Arrange
            const int expectedCount = 2;
            var data = SetUpData();
            var repo = new TestContactRepository(data);

            var testClass = new Web.Controllers.ContactController(repo);

            //Action
            var pagedData = testClass.GetAllPaged(1, 2);

            //Assert
            Assert.Equal(pagedData.Count(), expectedCount);
        }