コード例 #1
0
        public void ServerSettingsProperty()
        {
            // ARRANGE
            IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true);
            DracoonServerImpl      s = new DracoonServerImpl(c);

            // ACT

            // ASSERT
            Assert.NotNull(s.ServerSettings);
        }
コード例 #2
0
        public void GetVersion()
        {
            // ARRANGE
            string expected          = "4.13.0";
            IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true);
            DracoonServerImpl      s = new DracoonServerImpl(c);

            Mock.Arrange(() => c.Builder.GetServerVersion()).Returns(FactoryRestSharp.RestRequestWithoutAuth(ApiConfig.ApiGetServerVersion, Method.GET)).Occurs(1);
            Mock.Arrange(() => c.Executor.DoSyncApiCall <ApiServerVersion>(Arg.IsAny <IRestRequest>(), RequestType.GetServerVersion, 0)).Returns(FactoryServer.ApiServerVersionMock).Occurs(1);

            // ACT
            string actual = s.GetVersion();

            // ASSERT
            Assert.Equal(expected, actual);
            Mock.Assert(c.Builder);
            Mock.Assert(c.Executor);
        }
コード例 #3
0
        public void GetTime()
        {
            // ARRANGE
            DateTime expected        = new DateTime(2000, 1, 1, 0, 0, 0);
            IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true);
            DracoonServerImpl      s = new DracoonServerImpl(c);

            Mock.Arrange(() => c.Builder.GetServerTime()).Returns(FactoryRestSharp.RestRequestWithoutAuth(ApiConfig.ApiGetServerTime, Method.GET)).Occurs(1);
            Mock.Arrange(() => c.Executor.DoSyncApiCall <ApiServerTime>(Arg.IsAny <IRestRequest>(), RequestType.GetServerTime, 0)).Returns(FactoryServer.ApiServerTimeMock).Occurs(1);

            // ACT
            DateTime?actual = s.GetTime();

            // ASSERT
            Assert.True(actual.HasValue);
            Assert.Equal(expected, actual.Value);
            Mock.Assert(c.Builder);
            Mock.Assert(c.Executor);
        }