Exemple #1
0
 public void Then_TheCountryShouldNotExistInTheDataStore()
 {
     try
     {
         CountriesClient.GetCountry(TestCountriesCreated.First().Id).GetAwaiter().GetResult();
         Assert.Fail();
     }
     catch (ApiInvokerException)
     {
         TestCountriesCreated.Remove(TestCountriesCreated.First());
     }
 }
Exemple #2
0
        public void Then_TheCountryShouldBeReturned()
        {
            var createdTestCountry = TestCountriesCreated.First();

            Assert.AreEqual(createdTestCountry.Alpha2Code, CountryRecievedFromApi.Alpha2Code);
            Assert.AreEqual(createdTestCountry.Alpha3Code, CountryRecievedFromApi.Alpha3Code);
            Assert.AreEqual(createdTestCountry.CreatedByUserId, CountryRecievedFromApi.CreatedByUserId);
            Assert.AreEqual(createdTestCountry.EffectiveEndDate, CountryRecievedFromApi.EffectiveEndDate);
            Assert.AreEqual(createdTestCountry.EffectiveStartDate, CountryRecievedFromApi.EffectiveStartDate);
            Assert.AreEqual(createdTestCountry.FullName, CountryRecievedFromApi.FullName);
            Assert.AreEqual(createdTestCountry.Iso3166Code, CountryRecievedFromApi.Iso3166Code);
            Assert.AreEqual(createdTestCountry.PhoneNumberRegex, CountryRecievedFromApi.PhoneNumberRegex);
            Assert.AreEqual(createdTestCountry.PostalCodeRegex, CountryRecievedFromApi.PostalCodeRegex);
            Assert.AreEqual(createdTestCountry.ShortName, CountryRecievedFromApi.ShortName);
            Assert.AreEqual(createdTestCountry.Id, CountryRecievedFromApi.Id);
            Assert.AreEqual(createdTestCountry.CreatedOn, CountryRecievedFromApi.CreatedOn.UtcDateTime);
            Assert.AreEqual(createdTestCountry.LastUpdatedByUserId, CountryRecievedFromApi.LastUpdatedByUserId);
            Assert.AreEqual(createdTestCountry.LastUpdatedOn, CountryRecievedFromApi.LastUpdatedOn);
        }
Exemple #3
0
        public void When_UpdateIsInvokedOnTheCountriesApiWithTheFollowingValues(Table table)
        {
            var countryIdToUpdate = TestCountriesCreated.First().Id;

            CountryValuesToUpdate = table.CreateInstance <Country>();

            CountriesClient.UpdateCountry(new Country
            {
                Alpha2Code         = CountryValuesToUpdate.Alpha2Code,
                Alpha3Code         = CountryValuesToUpdate.Alpha3Code,
                Id                 = countryIdToUpdate,
                FullName           = CountryValuesToUpdate.FullName,
                ShortName          = CountryValuesToUpdate.ShortName,
                EffectiveEndDate   = CountryValuesToUpdate.EffectiveEndDate,
                EffectiveStartDate = CountryValuesToUpdate.EffectiveStartDate,
                Iso3166Code        = CountryValuesToUpdate.Iso3166Code,
                PhoneNumberRegex   = CountryValuesToUpdate.PhoneNumberRegex,
                PostalCodeRegex    = CountryValuesToUpdate.PostalCodeRegex
            }).GetAwaiter().GetResult();
        }
Exemple #4
0
        public void Then_TheCountryShouldBeUpdated()
        {
            var createdCountry = TestCountriesCreated.First();

            CountryRecievedFromApi = CountriesClient.GetCountry(createdCountry.Id).GetAwaiter().GetResult();

            Assert.AreEqual(CountryValuesToUpdate.Alpha2Code, CountryRecievedFromApi.Alpha2Code);
            Assert.AreEqual(CountryValuesToUpdate.Alpha3Code, CountryRecievedFromApi.Alpha3Code);
            Assert.AreEqual(createdCountry.CreatedByUserId, CountryRecievedFromApi.CreatedByUserId);
            Assert.AreEqual(CountryValuesToUpdate.EffectiveEndDate, CountryRecievedFromApi.EffectiveEndDate);
            Assert.AreEqual(CountryValuesToUpdate.EffectiveStartDate, CountryRecievedFromApi.EffectiveStartDate);
            Assert.AreEqual(CountryValuesToUpdate.FullName, CountryRecievedFromApi.FullName);
            Assert.AreEqual(CountryValuesToUpdate.Iso3166Code, CountryRecievedFromApi.Iso3166Code);
            Assert.AreEqual(CountryValuesToUpdate.PhoneNumberRegex, CountryRecievedFromApi.PhoneNumberRegex);
            Assert.AreEqual(CountryValuesToUpdate.PostalCodeRegex, CountryRecievedFromApi.PostalCodeRegex);
            Assert.AreEqual(CountryValuesToUpdate.ShortName, CountryRecievedFromApi.ShortName);
            Assert.AreEqual(createdCountry.Id, CountryRecievedFromApi.Id);
            Assert.AreEqual(createdCountry.CreatedOn, CountryRecievedFromApi.CreatedOn.UtcDateTime);
            Assert.AreEqual(-365, CountryRecievedFromApi.LastUpdatedByUserId);
            Assert.IsTrue(DateTimeOffset.UtcNow.AddSeconds(-1) < CountryRecievedFromApi.LastUpdatedOn.Value.UtcDateTime && CountryRecievedFromApi.LastUpdatedOn.Value.UtcDateTime < DateTimeOffset.UtcNow.AddSeconds(1));
        }
Exemple #5
0
 public void When_GetIsInvokedOnTheCountriesApiWithTheCountrysId()
 {
     CountryRecievedFromApi = CountriesClient.GetCountry(TestCountriesCreated.First().Id).GetAwaiter().GetResult();
 }
Exemple #6
0
 public void Then_TheCountryShouldExistInTheDataStore()
 {
     CountryRecievedFromApi = CountriesClient.GetCountry(TestCountriesCreated.First().Id).GetAwaiter().GetResult();
     Assert.IsNotNull(CountryRecievedFromApi);
 }
Exemple #7
0
 public void When_ForceDeleteIsInvokdeOnTheCountriesApiWithTheCountrysId()
 {
     Cleanup(new[] { TestCountriesCreated.First() });
 }
Exemple #8
0
 public void When_DeleteIsInvokedOnTheCountriesApiWithTheCountrysId()
 {
     CountriesClient.DeleteCountry(TestCountriesCreated.First().Id).GetAwaiter().GetResult();
 }