public void CreateCountry_SameCountryCodes_ReturnsSameObjects() { var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry("BG"); var c2 = countryFactory.CreateCountry("BG"); Assert.AreSame(c1, c2); }
public void CreateCountry_DifferentCountryCodes_ReturnsDifferentObjects() { var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry("BG"); var c2 = countryFactory.CreateCountry("GB"); Assert.AreNotSame(c1, c2); }
public void CreateCountry_SameCountryCodes_ReturnsSameObjects() { var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry("BG"); var c2 = countryFactory.CreateCountry("BG"); Assert.AreSame(c1, c2); }
public void CreateCountry_DifferentCountryCodes_ReturnsDifferentObjects() { var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry("BG"); var c2 = countryFactory.CreateCountry("GB"); Assert.AreNotSame(c1, c2); }
public void TwoCountryObjectsShouldShareTheString() { var country = new string(new char[] { 'D', 'Z' }); var countryCopy = new string(new char[] { 'D', 'Z' }); Assert.AreNotSame(country, countryCopy); var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry(country); var c2 = countryFactory.CreateCountry(countryCopy); Assert.AreSame(c1, c2); Assert.AreSame(c1.Code, c2.Code); Assert.AreEqual(c1.Code, country.ToUpperInvariant()); }
public IHttpActionResult Get(string sort = "id") { try { var countries = _repository.GetCountries(); return(Ok(countries.ApplySort(sort).ToList() .Select(ct => _countryFactory.CreateCountry(ct)))); } catch (Exception) { return(InternalServerError()); } }
public void TwoCountryObjectsShouldShareTheString() { var country = new string(new char[] { 'D', 'Z' }); var countryCopy = new string(new char[] { 'D', 'Z' }); Assert.AreNotSame(country, countryCopy); var countryFactory = new CountryFactory(CreateMockValidator()); var c1 = countryFactory.CreateCountry(country); var c2 = countryFactory.CreateCountry(countryCopy); Assert.AreSame(c1, c2); Assert.AreSame(c1.Code, c2.Code); Assert.AreEqual(c1.Code, country.ToUpperInvariant()); }
public void WithBritishZipCode_ReturnsTrueIfFormatMatchedAndCodesAreContained() { var cFactory = new CountryFactory(new IsoCountryCodeValidator()); var pcFactory = new PostalCodeFactory(); var country = cFactory.CreateCountry("GB"); var right = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "BB9 9AA")); var left = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "CC9 9AA")); Assert.IsTrue(PostalCodeRange.Contains(left, right)); }
public void WithBritishZipCode_ReturnsFalseIfFormatsSameLengthButDifferentFormat() { var cFactory = new CountryFactory(new IsoCountryCodeValidator()); var pcFactory = new PostalCodeFactory(); var country = cFactory.CreateCountry("GB"); var right = new PostalCodeRange(pcFactory.CreatePostalCode(country, "A99 9AA"), pcFactory.CreatePostalCode(country, "B99 9AA")); var left = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "CC9 9AA")); Assert.IsFalse(PostalCodeRange.Contains(left, right)); }
public void CreateCountry_ValidCountryCode_ReturnsValidObject() { const string countryCode = "PL"; var countryFactory = new CountryFactory(CreateMockValidator()); var country = countryFactory.CreateCountry(countryCode); Assert.IsNotNull(country); Assert.AreEqual("PL", country.Code); }
public void CreateCountry_ValidCountryCode_ReturnsValidObject() { const string countryCode = "PL"; var countryFactory = new CountryFactory(CreateMockValidator()); var country = countryFactory.CreateCountry(countryCode); Assert.IsNotNull(country); Assert.AreEqual("PL", country.Code); }
public OrderIncomeAggTest() { OrderIncome order = new OrderIncome(); //Constructor EF string lastName = "El rojo"; string firstName = "Jhon"; string telephone = "+34111111"; string company = "company name"; _country = CountryFactory.CreateCountry("Spain", "es-ES"); _customer = CustomerFactory.CreateCustomer(firstName, lastName, telephone, company, "*****@*****.**", _country, new Address("city", "zipcode", "AddressLine1", "AddressLine2")); for (int i = 0; i < 5; i++) { Product prod = ProductFactory.CreateProduct("product" + i, "description" + i); _products.Add(prod); } }
public void WithBritishZipCode_ReturnsTrueIfFormatMatchedAndCodesAreContained() { var cFactory = new CountryFactory(new IsoCountryCodeValidator()); var pcFactory = new PostalCodeFactory(); var country = cFactory.CreateCountry("GB"); var right = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "BB9 9AA")); var left = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "CC9 9AA")); Assert.IsTrue(PostalCodeRange.Contains(left, right)); }
public void WithBritishZipCode_ReturnsFalseIfFormatsSameLengthButDifferentFormat() { var cFactory = new CountryFactory(new IsoCountryCodeValidator()); var pcFactory = new PostalCodeFactory(); var country = cFactory.CreateCountry("GB"); var right = new PostalCodeRange(pcFactory.CreatePostalCode(country, "A99 9AA"), pcFactory.CreatePostalCode(country, "B99 9AA")); var left = new PostalCodeRange(pcFactory.CreatePostalCode(country, "AA9 9AA"), pcFactory.CreatePostalCode(country, "CC9 9AA")); Assert.IsFalse(PostalCodeRange.Contains(left, right)); }