Ejemplo n.º 1
0
        public void Constructor_GivenReturnDataId_ReturnIdShouldBeSet()
        {
            var returnData = DefaultReturnData();

            var model = new ReturnViewModelTest(returnData);

            model.ReturnId.Should().Be(returnData.Id);
        }
Ejemplo n.º 2
0
        public void Constructor_GivenReturnDataIsNull_ArgumentNullExceptionExpected()
        {
            Action action = () =>
            {
                var model = new ReturnViewModelTest(null);
            };

            action.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 3
0
        public void Constructor_GivenSubmittedDateEmpty_SubmittedDateShouldBeFormattedAsDash(string submittedBy)
        {
            var model = new ReturnViewModelTest(new ReturnData()
            {
                Quarter = GetQuarter(), QuarterWindow = GetQuarterWindow(), SubmittedBy = submittedBy
            });

            model.SubmittedBy.Should().Be("-");
        }
Ejemplo n.º 4
0
        public void Constructor_GivenSubmittedBy_SubmittedPropertiesShouldBeSet()
        {
            var returnData = new ReturnData()
            {
                SubmittedBy = "submittedBy", SubmittedDate = new DateTime(2019, 1, 1, 11, 1, 2), Quarter = GetQuarter(), QuarterWindow = GetQuarterWindow()
            };

            var model = new ReturnViewModelTest(returnData);

            model.SubmittedBy.Should().Be("submittedBy");
            model.SubmittedDate.Should().Be("01/01/2019 11:01:02");
        }
Ejemplo n.º 5
0
        public void Constructor_GivenQuarterWindowIsNull_ArgumentNullExceptionExpected()
        {
            var returnData = new ReturnData()
            {
                Quarter = new Quarter(2019, QuarterType.Q1)
            };

            Action action = () =>
            {
                var model = new ReturnViewModelTest(returnData);
            };

            action.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 6
0
        public void Constructor_GivenQuarterIsNull_ArgumentNullExceptionExpected()
        {
            var returnData = new ReturnData()
            {
                QuarterWindow = QuarterWindowTestHelper.GetDefaultQuarterWindow()
            };

            Action action = () =>
            {
                var model = new ReturnViewModelTest(returnData);
            };

            action.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 7
0
        public void Constructor_GivenQuarterDetails_QuarterPropertiesShouldBeSet()
        {
            var returnData = new ReturnData()
            {
                Quarter = GetQuarter(), QuarterWindow = GetQuarterWindow()
            };

            var model = new ReturnViewModelTest(returnData);

            model.Year.Should().Be(returnData.Quarter.Year.ToString());
            model.Quarter.Should().Be(returnData.Quarter.Q.ToString());
            model.Period.Should()
            .Be(
                $"{returnData.Quarter.Q.ToString()} {returnData.QuarterWindow.QuarterStart.ToString("MMM", CultureInfo.CurrentCulture)} - {returnData.QuarterWindow.QuarterEnd.ToString("MMM", CultureInfo.CurrentCulture)} {returnData.Quarter.Year}");
        }
Ejemplo n.º 8
0
        public void Constructor_GivenReturnStatus_ReturnStatusShouldBeSet()
        {
            foreach (var value in Enum.GetValues(typeof(ReturnStatus)))
            {
                var returnData = new ReturnData()
                {
                    Quarter       = GetQuarter(),
                    QuarterWindow = GetQuarterWindow(),
                    ReturnStatus  = (ReturnStatus)value
                };

                var model = new ReturnViewModelTest(returnData);

                model.ReturnStatus.Should().Be((ReturnStatus)value);
            }
        }
Ejemplo n.º 9
0
        public void Constructor_GivenSubmittedDateIsNull_SubmittedDateShouldBeFormattedAsDash()
        {
            var model = new ReturnViewModelTest(DefaultReturnData());

            model.SubmittedDate.Should().Be("-");
        }