mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-06 00:42:08 +00:00
fix(vendors): keep location fallback atomic
This commit is contained in:
parent
d0a90483b3
commit
9c3da9b5e3
2 changed files with 17 additions and 8 deletions
|
|
@ -440,15 +440,15 @@ public class VendorDataServiceTests
|
||||||
Name = "Searchable Co",
|
Name = "Searchable Co",
|
||||||
NormalizedName = "searchable co",
|
NormalizedName = "searchable co",
|
||||||
City = "Chicago",
|
City = "Chicago",
|
||||||
State = "IL"
|
State = null
|
||||||
};
|
};
|
||||||
context.VendorCompanies.Add(company);
|
context.VendorCompanies.Add(company);
|
||||||
context.Vendors.Add(new Vendor
|
context.Vendors.Add(new Vendor
|
||||||
{
|
{
|
||||||
CompanyName = "Searchable Co",
|
CompanyName = "Searchable Co",
|
||||||
ContactName = "Pat",
|
ContactName = "Pat",
|
||||||
City = null,
|
City = "Stale City",
|
||||||
State = null,
|
State = "TX",
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
Company = company
|
Company = company
|
||||||
|
|
@ -461,10 +461,15 @@ public class VendorDataServiceTests
|
||||||
1,
|
1,
|
||||||
50,
|
50,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
locations: new[] { "Chicago, IL" });
|
locations: new[] { "Chicago" });
|
||||||
|
|
||||||
search.Items.Should().ContainSingle(i => i.ContactName == "Pat");
|
var searchRow = search.Items.Should().ContainSingle(i => i.ContactName == "Pat").Subject;
|
||||||
location.Items.Should().ContainSingle(i => i.ContactName == "Pat");
|
searchRow.City.Should().Be("Chicago");
|
||||||
|
searchRow.State.Should().BeNull();
|
||||||
|
|
||||||
|
var locationRow = location.Items.Should().ContainSingle(i => i.ContactName == "Pat").Subject;
|
||||||
|
locationRow.City.Should().Be("Chicago");
|
||||||
|
locationRow.State.Should().BeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
|
||||||
|
|
@ -200,10 +200,14 @@ namespace SeaHaven.DataServices.Implementation
|
||||||
CompanyPhone = v.CompanyPhone,
|
CompanyPhone = v.CompanyPhone,
|
||||||
PreferredContact = v.PreferredContact,
|
PreferredContact = v.PreferredContact,
|
||||||
Address = v.Address,
|
Address = v.Address,
|
||||||
City = v.Company != null && v.Company.City != null && v.Company.City.Trim() != ""
|
City = v.Company != null &&
|
||||||
|
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
||||||
|
(v.Company.State != null && v.Company.State.Trim() != ""))
|
||||||
? v.Company.City
|
? v.Company.City
|
||||||
: v.City,
|
: v.City,
|
||||||
State = v.Company != null && v.Company.State != null && v.Company.State.Trim() != ""
|
State = v.Company != null &&
|
||||||
|
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
||||||
|
(v.Company.State != null && v.Company.State.Trim() != ""))
|
||||||
? v.Company.State
|
? v.Company.State
|
||||||
: v.State,
|
: v.State,
|
||||||
Zip = v.Zip,
|
Zip = v.Zip,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue