public void GenerateDataOfTheWeek_ReturnsCorrectModel_ShouldBeReturns_ParityOfTheWeekModel()
        {
            // Arrange
            var fixture = new Fixture();

            fixture.Customize(new AutoMoqCustomization());

            var mapper = fixture.Freeze <Mock <IMapper> >();
            var parityOfTheWeekConfigurationModel = fixture.Freeze <Mock <ParityOfTheWeekConfigurationModel> >();

            var dateTimeTest = new DateTime(2018, 11, 11);

            var expectedModel = new ParityOfTheWeekModel
            {
                DateTimeRequest   = dateTimeTest,
                DayOfName         = "воскресенье",
                NumberOfSemester  = 5,
                ParityOfWeekCount = 10,
                ParityOfWeekToday = true,
                PartOfSemester    = 1
            };

            // Act
            var service = new ParityOfTheWeekService(mapper.Object, parityOfTheWeekConfigurationModel.Object);
            var result  = service.GenerateDataOfTheWeek(dateTimeTest);

            // Assert
            Assert.AreEqual(expectedModel.DateTimeRequest, result.DateTimeRequest);
        }
        public void GetPartOfSemester_PartOFSemester_ReturnsExpectedValue(
            DateTime dateTime, int expected)
        {
            // Arrange
            var dateTimeTest = dateTime;  // new DateTime(2018, 11, 11);

            // Act
            var service = new ParityOfTheWeekService(_parityOfTheWeekConfigurationModel.Object, _mockMapper.Object);
            var result  = service.GetPartOfSemester(dateTimeTest);

            // Assert
            Assert.Equal(expected, result);
        }
        public void GetCountParityOfWeek_CountOfParity_ReturnsExpectedValue(
            DateTime dateTime,
            int expected)
        {
            // Arrange
            var dateTimeTest = dateTime;

            // Act
            var service = new ParityOfTheWeekService(_parityOfTheWeekConfigurationModel.Object, _mockMapper.Object);
            var result  = service.GetCountParityOfWeek(dateTimeTest);

            // Assert
            Assert.Equal(expected, result);
        }
        public void GetParityOfTheWeekByDateTime_ParityBoolValue_ReturnsExpectedValue(
            DateTime dateTime,
            bool expected)
        {
            // Arrange
            var dateTimeTest = dateTime;

            // Act
            var service = new ParityOfTheWeekService(_parityOfTheWeekConfigurationModel.Object, _mockMapper.Object);
            var result  = service.GetParityOfTheWeekByDateTime(dateTimeTest);

            // Assert
            Assert.Equal(expected, result);
        }
        public void IsHoliday_IsHolidayValue_ReturnsExpectedValue(
            DateTime dateTime,
            bool isSixDayWeek,
            bool expected)
        {
            // Arrange
            var dateTimeTest = dateTime;

            // Act
            var service = new ParityOfTheWeekService(_parityOfTheWeekConfigurationModel.Object, _mockMapper.Object);
            var result  = service.IsHoliday(dateTimeTest, isSixDayWeek);

            // Assert
            Assert.Equal(expected, result);
        }
        public void GetNumberOfSemester_NumberOfSemester_ReturnsExpectedValue(
            DateTime dateTime,
            int startLearningDateParam,
            int expected)
        {
            // Arrange
            var dateTimeTest      = dateTime;
            var startLearningDate = startLearningDateParam;

            // Act
            var service = new ParityOfTheWeekService(_parityOfTheWeekConfigurationModel.Object, _mockMapper.Object);
            var result  = service.GetNumberOfSemester(dateTimeTest, startLearningDate);

            // Assert
            Assert.Equal(expected, result);
        }
        public void GenerateDataOfTheWeek_ParityOfTheWeekModel_ReturnsExpectedValue(
            DateTime dateTime,
            IOptions <ParityOfTheWeekConfigurationModel> parityOfTheWeekConfigurationModel,
            ParityOfTheWeekModel expected)
        {
            // Arrange
            var dateTimeTest = dateTime;

            // Act
            var service = new ParityOfTheWeekService(parityOfTheWeekConfigurationModel, _mapper);
            var result  = service.GenerateDataOfTheWeek(dateTimeTest);

            _testOutputHelper.WriteLine(result.ToJson());
            _testOutputHelper.WriteLine(expected.ToJson());
            var isCompare = Compare(result, expected);

            // Assert
            Assert.True(isCompare);
        }
        public void GetCountParityOfWeek_ReturnsCountOfParity_ShouldBeReturns_10()
        {
            // Arrange
            var fixture = new Fixture();

            fixture.Customize(new AutoMoqCustomization());

            var dateTimeTest = new DateTime(2018, 11, 11);

            var mapper = fixture.Freeze <Mock <IMapper> >();
            var parityOfTheWeekConfigurationModel = fixture.Freeze <Mock <ParityOfTheWeekConfigurationModel> >();

            // Act
            var service = new ParityOfTheWeekService(mapper.Object, parityOfTheWeekConfigurationModel.Object);
            var result  = service.GetCountParityOfWeek(dateTimeTest);

            // Assert
            Assert.AreEqual(10, result);
        }
        public void GetParityOfTheWeekByDateTime_ReturnsParityBoolValue_ShouldBeReturns_True()
        {
            // Arrange
            var fixture = new Fixture();

            fixture.Customize(new AutoMoqCustomization());

            var dateTimeTest = new DateTime(2018, 11, 11);

            var mapper = fixture.Freeze <Mock <IMapper> >();
            var parityOfTheWeekConfigurationModel = fixture.Freeze <Mock <ParityOfTheWeekConfigurationModel> >();

            // Act
            var service = new ParityOfTheWeekService(mapper.Object, parityOfTheWeekConfigurationModel.Object);
            var result  = service.GetParityOfTheWeekByDateTime(dateTimeTest);

            // Assert
            Assert.IsTrue(result);
        }
        public void PrepareViewModel_ViewModel_ReturnsExpectedValue(
            IOptions <ParityOfTheWeekConfigurationModel> parityOfTheWeekConfigurationModel,
            ParityOfTheWeekModel parityOfTheWeekModelParam,
            ParityOfTheWeekViewModel expected
            )
        {
            // Arrange
            var parityOfTheWeekModel = parityOfTheWeekModelParam;

            // Act
            var service = new ParityOfTheWeekService(parityOfTheWeekConfigurationModel, _mapper);
            var result  = service.PrepareViewModel(parityOfTheWeekModel);

            _testOutputHelper.WriteLine(result.ToJson());
            _testOutputHelper.WriteLine(expected.ToJson());
            var isCompare = Compare(result, expected);

            // Assert
            Assert.True(isCompare);
        }
        public void GetNumberOfSemester_ReturnsNumberOfSemester_ShouldBeReturns_5()
        {
            // Arrange
            var fixture = new Fixture();

            fixture.Customize(new AutoMoqCustomization());

            var dateTimeTest = new DateTime(2018, 11, 11);

            var mapper = fixture.Freeze <Mock <IMapper> >();
            var parityOfTheWeekConfigurationModel = fixture.Freeze <Mock <ParityOfTheWeekConfigurationModel> >();

            var startLearningDate = 2016;

            // Act
            var service = new ParityOfTheWeekService(mapper.Object, parityOfTheWeekConfigurationModel.Object);
            var result  = service.GetNumberOfSemester(dateTimeTest, startLearningDate);

            // Assert
            Assert.AreEqual(5, result);
        }