コード例 #1
0
 public void CreateSleep_AllPropertiesValid_DoesNotThrowArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     SleepEndpoint sleepRequest = new SleepEndpoint(tokenManager.Object, new UsersModel());
     //Act and Assert
     Assert.DoesNotThrow(() => { sleepRequest.CreateSleep(ValidSleepNew); });
 }
コード例 #2
0
 public void DeleteSleepAsync_UriValid_DoesNotThrowArgumentException()
 {
     //Arrange
     var validPath = "/test/";
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     SleepEndpoint sleepRequest = new SleepEndpoint(tokenManager.Object, new UsersModel { Sleep = validPath });
     //Act and Assert
     Assert.DoesNotThrow(() => { sleepRequest.DeleteSleepAsync(() => { }, (ex) => { }, validPath); });
 }
コード例 #3
0
 public void CreateSleep_AllMeasurementsNull_ArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     SleepEndpoint sleepRequest = new SleepEndpoint(tokenManager.Object, new UsersModel());
     //Act
     ValidSleepNew.Awake = null;
     ValidSleepNew.Deep = null;
     ValidSleepNew.Light = null;
     ValidSleepNew.Rem = null;
     ValidSleepNew.TimesWoken = null;
     ValidSleepNew.TotalSleep = null;
     //Assert
     Assert.Throws(typeof(ArgumentException), () => { sleepRequest.CreateSleep(ValidSleepNew); });
 }
コード例 #4
0
 public void DeleteSleep_UriNotValid_ArgumentException()
 {
     //Arrange
     var validPath = "/test/";
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     SleepEndpoint sleepRequest = new SleepEndpoint(tokenManager.Object, new UsersModel { Sleep = validPath });
     //Act and Assert
     Assert.Throws(typeof(ArgumentException), () => { sleepRequest.DeleteSleep("Not validPath."); });
 }