public void ShouldFetchInstallationsFromNetworkFunc_LocationChanged() { TestItems(out var installation1, out var installation2, out _, out _, out _, out _); Either <Error, List <InstallationEntity> > InstallationsFromDb() => new List <InstallationEntity> { installation1.ToInstallationEntity(), installation2.ToInstallationEntity() }; var replacedInstallationsCounter = 0; Either <Error, List <Installation> > ReplacingInstallationsFunc(List <Installation> list) { replacedInstallationsCounter += 1; return(list); } Either <Error, List <Installation> > FetchingFromNetworkFunc(Location location) => new List <Installation> { installation2 }; var functionUnderTest = HomeModel.FetchInstallationsFromDbOrNetwork(InstallationsFromDb)(ReplacingInstallationsFunc)( FetchingFromNetworkFunc); var result = functionUnderTest(new Location(-80.0, -80.0)); Assert.AreEqual(1, replacedInstallationsCounter, "Should try to replace installations in database once"); result.Match(error => Assert.Fail("Should match to the right"), list => { Assert.AreEqual(1, list.Count, "Should return list from FetchingFromNetworkFunc, which contains 1 item"); Assert.AreEqual(installation2, list.First(), "Should return installation from FetchingFromNetworkFunc"); }); }