public void SettingResolution_WhenCall_CheckResolutionNotSupported(int width, int height) { //Arrange ScreenResolutionService screenResolutionAdapter = Substitute.For <ScreenResolutionService>(); Resolution resolutionMock = new Resolution() { width = width, height = height }; screenResolutionAdapter.ResolutionsSupported.Returns(new Resolution[] { resolutionMock }); Container.Bind <ScreenResolutionService>().FromInstance(screenResolutionAdapter); ScreenResolutionAutoDetectService resolutionSetter = Container.Resolve <ScreenResolutionAutoDetectService>(); //Assert Assert.Throws <Exception>(() => resolutionSetter.SettingResolution()); }
public void SettingResolution_WhenCall_CheckScreenHDResolution() { //Arrange Resolution resolutionHDMock = new Resolution() { width = 1280, height = 720 }; ScreenResolutionService screenResolutionAdapter = Substitute.For <ScreenResolutionService>(); screenResolutionAdapter.ResolutionsSupported.Returns(new Resolution[] { resolutionHDMock }); Container.Bind <ScreenResolutionService>().FromInstance(screenResolutionAdapter); ScreenResolutionAutoDetectService resolutionSetter = Container.Resolve <ScreenResolutionAutoDetectService>(); //Act resolutionSetter.SettingResolution(); //Assert screenResolutionAdapter.Received().SetResolution(1280, 720, true, 60); }