예제 #1
0
        public async Task WhenGivenATenancyRef_TenancyDetail_ShouldRespondWithFormattedJson_Example1()
        {
            var allTenancyDetails = new TenancyDetailsForRefStub();

            allTenancyDetails.AddTenancyDetail("0test/01", new TenancyDetailsForRef.Tenancy
            {
                TenancyRef                = "0test/01",
                PropertyRef               = "prop/01",
                Tenure                    = "SEC",
                Rent                      = "91.1",
                Service                   = "12.0",
                OtherCharge               = "2.0",
                ArrearsAgreementStatus    = "Breached",
                CurrentBalance            = "23.01",
                PrimaryContactName        = "Rashmi",
                PrimaryContactLongAddress = "AquaLand",
                PrimaryContactPostcode    = "e8 1hh",
                ArrearsAgreements         = new List <TenancyDetailsForRef.ArrearsAgreement>
                {
                    new TenancyDetailsForRef.ArrearsAgreement
                    {
                        Amount       = "23.01",
                        Breached     = "True",
                        ClearBy      = "2018-12-03 00:00:00Z",
                        Frequency    = "Weekly",
                        StartBalance = "10.00",
                        Startdate    = "2018-01-03 00:00:00Z",
                        Status       = "test"
                    },
                    new TenancyDetailsForRef.ArrearsAgreement
                    {
                        Amount       = "24.01",
                        Breached     = "False",
                        ClearBy      = "2018-12-04 00:00:00Z",
                        Frequency    = "Monthly",
                        StartBalance = "11.00",
                        Startdate    = "2018-02-03 00:00:00Z",
                        Status       = "test1"
                    }
                },
                ArrearsActionDiary = new List <TenancyDetailsForRef.ArrearsActionDiaryEntry>
                {
                    new TenancyDetailsForRef.ArrearsActionDiaryEntry
                    {
                        Balance = "22.0",
                        Code    = "DEF12",
                        Type    = "Code name",
                        Comment = "Some Comments",
                        Date    = "2018-12-03 00:00:00Z",
                        UniversalHousingUsername = "******"
                    },
                    new TenancyDetailsForRef.ArrearsActionDiaryEntry
                    {
                        Balance = "23.0",
                        Code    = "DEF123",
                        Type    = "Code name",
                        Comment = "Some Comments",
                        Date    = "2018-11-03 00:00:00Z",
                        UniversalHousingUsername = "******"
                    }
                }
            });

            var response = await GetAllTenancyDetailsForTenancyRef(allTenancyDetails, "0test/01");

            var actualResponse = JSONHelper.ResponseJson(response);
            var expectedJson   = JsonConvert.SerializeObject(getExpectedJSONExample1());

            Assert.Equal(expectedJson, actualResponse);
        }
예제 #2
0
        public async Task WhenGivenATenancyRef_TenancyDetail_ShouldRespondWithFormattedJson_Example2()
        {
            var allTenancyDetails = new TenancyDetailsForRefStub();

            allTenancyDetails.AddTenancyDetail("0test/02", new TenancyDetailsForRef.Tenancy
            {
                TenancyRef                = "0test/02",
                PropertyRef               = "prop/02",
                Tenure                    = "TEM",
                Rent                      = "92.1",
                Service                   = "13.0",
                OtherCharge               = "3.0",
                ArrearsAgreementStatus    = "Active",
                CurrentBalance            = "21.01",
                PrimaryContactName        = "Vlad",
                PrimaryContactLongAddress = "AquaLand123",
                PrimaryContactPostcode    = "e8 2ii",
                ArrearsAgreements         = new List <TenancyDetailsForRef.ArrearsAgreement>
                {
                    new TenancyDetailsForRef.ArrearsAgreement
                    {
                        Amount       = "21.00",
                        Breached     = "False",
                        ClearBy      = "2017-12-03 00:00:00Z",
                        Frequency    = "Weekly",
                        StartBalance = "101.00",
                        Startdate    = "2016-01-02 00:00:00Z",
                        Status       = "test2"
                    },
                    new TenancyDetailsForRef.ArrearsAgreement
                    {
                        Amount       = "21.33",
                        Breached     = "True",
                        ClearBy      = "2017-12-09 00:00:00Z",
                        Frequency    = "Monthly",
                        StartBalance = "112.00",
                        Startdate    = "2016-03-04 00:00:00Z",
                        Status       = "test3"
                    }
                },
                ArrearsActionDiary = new List <TenancyDetailsForRef.ArrearsActionDiaryEntry>
                {
                    new TenancyDetailsForRef.ArrearsActionDiaryEntry
                    {
                        Balance = "44.11",
                        Code    = "XYZ12",
                        Type    = "Code one",
                        Comment = "Pretty great comment",
                        Date    = "2017-12-15 00:00:00Z",
                        UniversalHousingUsername = "******"
                    },
                    new TenancyDetailsForRef.ArrearsActionDiaryEntry
                    {
                        Balance = "44.22",
                        Code    = "XYZ123",
                        Type    = "Code nine",
                        Comment = "Extra great comment",
                        Date    = "2017-11-02 00:00:00Z",
                        UniversalHousingUsername = "******"
                    }
                }
            });

            var response = await GetAllTenancyDetailsForTenancyRef(allTenancyDetails, "0test/02");

            var actualResponse = JSONHelper.ResponseJson(response);
            var expectedJson   = JsonConvert.SerializeObject(getExpectedJSONExample2());

            Assert.Equal(expectedJson, actualResponse);
        }