示例#1
0
        public void List_Returns_Responses()
        {
            // Arrange
            m_Query.All.Returns(m_Entities);

            // Act
            IEnumerable <IGameReviewModel> actual = m_Sut.List();

            // Assert
            GameReviewHelper.
            AssertEntityAndResponse(m_Entities.ToArray(),
                                    actual.ToArray());
        }
示例#2
0
        public void List_ReturnsDays_WhenCalled()
        {
            // Arrange
            var repository = Substitute.For <IDaysRepository>();

            repository.All.Returns(CreateList);
            InformationFinder sut = CreateSut(repository);

            // Act
            IEnumerable <IDayForResponse> actual = sut.List();

            // Assert
            Assert.Equal(2,
                         actual.Count());
        }
        public void List_ReturnsSlots_ForDate(string date,
                                              int expected)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsSlotsRepository>();

            repository.FindSlotsForDoctorByDoctorId(Arg.Any <int>()).Returns(CreateList);
            InformationFinder sut = CreateSut(repository);

            // Act
            ISlot actual = sut.List(DoesNotMatter,
                                    date,
                                    null).First();

            // Assert
            Assert.Equal(expected,
                         actual.Id);
        }
        public void List_ReturnsCorrectNumberOfSlots_ForStatusOpen(string slotStatus,
                                                                   int expected)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsSlotsRepository>();

            repository.FindSlotsForDoctorByDoctorId(Arg.Any <int>()).Returns(CreateList);
            InformationFinder sut = CreateSut(repository);

            // Act
            IEnumerable <ISlot> actual = sut.List(DoesNotMatter,
                                                  null,
                                                  slotStatus);

            // Assert
            Assert.Equal(expected,
                         actual.Count());
        }
        public void List_ReturnsSlots_ForMultipleForDates()
        {
            // Arrange
            const string        date = "2001-01-01";
            IEnumerable <ISlot> list = CreateListWithSameDate(date);
            var repository           = Substitute.For <IDoctorsSlotsRepository>();

            repository.FindSlotsForDoctorByDoctorId(Arg.Any <int>()).Returns(list);
            InformationFinder sut = CreateSut(repository);

            // Act
            IEnumerable <ISlot> actual = sut.List(DoesNotMatter,
                                                  date,
                                                  null);

            // Assert
            Assert.Equal(3,
                         actual.Count());
        }
        public void List_ReturnsSlots_ForMultipleForStatus(SlotStatus status,
                                                           int expected)
        {
            // Arrange
            IEnumerable <ISlot> list = CreateListWithSameStatus(status);
            var repository           = Substitute.For <IDoctorsSlotsRepository>();

            repository.FindSlotsForDoctorByDoctorId(Arg.Any <int>()).Returns(list);
            InformationFinder sut = CreateSut(repository);

            // Act
            IEnumerable <ISlot> actual = sut.List(DoesNotMatter,
                                                  null,
                                                  status.ToString());

            // Assert
            Assert.Equal(expected,
                         actual.Count());
        }