public void BloodSugarInMgdL(float from, SugarUnit unit, float expectedTo) { var factories = new FactoriesImpl(); factories.StorageCreator = new StorageCreatorStub(); factories.Settings.SugarUnit = unit; var sut = new Sugar { BloodSugar = from }; sut.SetOwner(factories); Assert.AreEqual(expectedTo, sut.BloodSugarInMgdL); }
public void UiRenderedShowsWelcomeScreen(bool showWelcomeScreen) { var factories = new FactoriesImpl(); factories.StorageCreator = new StorageCreatorStub(); factories.Settings.ShowWelcomeScreen = showWelcomeScreen; var welcomeScreen = Substitute.For<WelcomeScreen>(); var sut = CreateSut(factories, welcomeScreen: welcomeScreen); var stateProvider = Substitute.For<StateProvider>(); stateProvider.State.Returns(new Dictionary<string, object>()); sut.StateProvider = stateProvider; sut.UiRendered(); welcomeScreen.Show.Received(showWelcomeScreen ? 1 : 0).Execute(null); Assert.IsFalse(factories.Settings.ShowWelcomeScreen); }